Edit configuration "mail.properties"

Hello

I tried to set the mail.properties in my rpi in the web page:

https://192.168.1.245:xxxx/admin#/users/edit/xxxxxxx@xxxxx.fr-Blynk

https://gyazo.com/afebebc4e5aa65a18244a80d917d81de

When I click on save, the page tells me it’s save.

But when I refreshed the page, the configuration was not taken into account, I try by relaunching the rpi and it’s the same

An idea ?

thx

I guess, by design, the V Save Changes confirmation is just in memory, for the current running Blynk Server process. Normally we use that feature to test, before finally implementing, after thorough testing / finding out the modification is OK.
I still think that designing this way is much better and smarter than forcing you to change the real config files, rebooting the Blynk Server, just to test, then finding out not OK, and repeating the process until everything is OK.
Whenever you’re satisfied with the results, you can edit the real config files (in your case mail.properties) to make the change permanent. Certainly you have to reboot the Blynk Server to make the change effective.

Hello

Thx khoih for your answer

Ok, I went to see ssh, but I can not find the file “mail.properties”.

Where is it in the rpi?

@ +

After you use SSH to log into RPi, for example if your Local Server Local IP Address is 192.168.2.112, you use this command from a computer terminal

$ ssh pi@192.168.2.112
pi@192.168.2.112's password: 
Linux raspberrypi-02 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l
....
pi@raspberrypi-02:~ $ find . -name mail.properties -print
./Blynk-Server/mail.properties        <======= This is where the file is
# Comment. Use this command to edit file mail.properties
pi@raspberrypi-02:~ $ gedit ./Blynk-Server/mail.properties

Normally, the file is at :
~/Blynk or ~/Blynk-Server, depending on where you installed the Blynk Server.

Thx for the answer.
when I search the file as requested
it does not return anything to me:

pi@ServeurBlynk:~ $ ls
Blynk  Desktop  Documents  Images  logs  MagPi  Modèles  Musique  Public  server-0.41.11-java8.jar  static  Téléchargements  Vidéos
pi@ServeurBlynk:~ $ find . -name mail.properties -print
pi@ServeurBlynk:~ $

So you installed Blynk Server jar without several necessary files, such as mail.properties, server.properties, etc.

You have to create / copy / modify and place them in your Blynk subdirectory

  1. Get file mail.properties from
  1. Get file server.properties from

I notice that you put the jar file server-0.41.11-java8.jar not in Blynk subdirectory. It’s better to move it into Blynk subdir. , together with those properties files, and remember to change the command to start the server correspondingly.

Thx for the answer.
I made the changes as requested
I created the 2 files in the folder. \ Blynk

pi@ServeurBlynk:~ $ ls
Blynk      Images  Modèles  server-0.41.11-java8.jar  Vidéos
Desktop    logs    Musique  static
Documents  MagPi   Public   Téléchargements
pi@ServeurBlynk:~ $ cd Blynk/
pi@ServeurBlynk:~/Blynk $ ls
backup  clone  data  deleted  xxxxxxo@xxxxx.fr.Blynk.user  mail.properties  server.properties
pi@ServeurBlynk:~/Blynk $

Is it normal for files to change ssh to not show up with registered items?

@ +

I am not the best in terminal unix

but I’m looking for logs rpi because apparently we can find information in
@ +

I’m sorry I don’t fully understand what you mean here
Is it normal for files to change ssh to not show up with registered items?
You can use French with or without English as I can understand.

I still don’t know why you don’t find logs subdirectory. Possibly because of permission. Can you try to use sudo, ls -la and find, such as

pi@ServeurBlynk:~ $ sudo ls -la
pi@ServeurBlynk:~ $ sudo find ~ -name logs -print
/home/pi/ServeurBlynk/logs
pi@ServeurBlynk:~ $ sudo ls -la /home/pi/ServeurBlynk/logs
total 164
drwx------ 3 pi   pi     4096 Dec  4 03:58 .
drwxr-xr-x 9 pi   pi     4096 Sep 30 13:29 ..
drwx------ 2 pi   pi     4096 Dec  4 03:58 archive
-rw-r--r-- 1 root root    283 Dec  4 17:04 blynk.log
-rw-r--r-- 1 root root     90 Sep 24 23:31 postgres.log
-rw-r--r-- 1 root root 134572 Sep 25 01:04 stats.log
-rw-r--r-- 1 root root   5486 Sep 25 01:04 worker.log
pi@ServeurBlynk:~ $

Note
Linux/Unix/Raspbian/Ubuntu are Linux-based OS’es, and no way anybody can remember all the commands’ usage. Anytime you need help, just use man (for manual), for example to understand all the usage of command find, use

pi@ServeurBlynk:~ $ man find

Bonjour :slight_smile:

Merci, j’ai trouvé les logs grâce à votre réponse.
dans : /home/pi/logs/blynk.log

je vais éditer le server.properties et le mail.properties correctement

Is it normal for files to change ssh to not show up with registered items?
est que c'est normal que les fichiers chnager en ssh ne sont pas rafraîchit/afficher dans la page web de configuration de Blynk.

Du coup ça répond sans doute à la phrase que vous n’aviez pas compris, Blynk ne charge pas ces 2 fichiers car ils sont mal éditer et donc ce sur la page web sont ce de base de Blynk. c’est ça ?

13:32:35.962 INFO - Region : local. Host : 192.168.1.245.
13:32:36.853 INFO - Initializing gmail smtp mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
13:32:36.946 INFO - Reports : 0
13:32:36.947 INFO - Didn't find custom user certificates.
13:32:36.951 INFO - Didn't find Let's Encrypt certificates.
13:32:36.951 WARN - You didn't specified 'server.host' or 'contact.email' properties in server.properties file. Automatic certificate generation is turned off. Please specify above properties for automatic certificates retrieval.
13:32:36.951 WARN - ATTENTION. Server certificate paths (cert : '/home/pi', key : '/home/pi') not valid. Using embedded server certs and one way ssl. This is not secure. Please replace it with your own certs.
13:32:44.582 ERROR- Error initializing HTTP API and WebSockets, port 8080
java.net.BindException: Adresse déjà utilisée
        at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
        at sun.nio.ch.Net.bind(Net.java:461) ~[?:?]
        at sun.nio.ch.Net.bind(Net.java:453) ~[?:?]
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227) ~[?:?]
        at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:132) ~[server-0.41.11-java8.jar:?]
        at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:551) ~[server-0.41.11-java8.jar:?]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1346) ~[server-0.41.11-java8.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:503) ~[server-0.41.11-java8.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:488) ~[server-0.41.11-java8.jar:?]
        at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:985) ~[server-0.41.11-java8.jar:?]
        at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:247) ~[server-0.41.11-java8.jar:?]
        at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:344) ~[server-0.41.11-java8.jar:?]
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[server-0.41.11-java8.jar:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:510) ~[server-0.41.11-java8.jar:?]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:518) ~[server-0.41.11-java8.jar:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044) ~[server-0.41.11-java8.jar:?]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[server-0.41.11-java8.jar:?]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[server-0.41.11-java8.jar:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]
13:38:46.076 INFO - Using data dir '/home/pi/Blynk'
13:38:47.390 INFO - Region : local. Host : 192.168.1.245.
13:38:48.400 INFO - Initializing gmail smtp mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
13:38:48.490 INFO - Reports : 0
13:38:48.491 INFO - Didn't find custom user certificates.
13:38:48.494 INFO - Didn't find Let's Encrypt certificates.
13:38:48.495 WARN - You didn't specified 'server.host' or 'contact.email' properties in server.properties file. Automatic certificate generation is turned off. Please specify above properties for automatic certificates retrieval.
13:38:48.495 WARN - ATTENTION. Server certificate paths (cert : '/home/pi', key : '/home/pi') not valid. Using embedded server certs and one way ssl. This is not secure. Please replace it with your own certs.
13:38:52.822 INFO - HTTP API and WebSockets server listening at 8080 port.
13:38:52.826 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
13:38:52.827 INFO - Mqtt hardware server listening at 8440 port.
13:38:53.451 INFO - xxx.xxxxxx@orange.fr hardware joined.
13:38:56.671 INFO - xxx.xxxxxx@orange.fr hardware joined.
13:38:57.264 INFO - xxx.xxxxxx@orange.fr hardware joined.
13:40:28.790 INFO - Updating config mail.properties. New body :
13:40:28.790 INFO - mail.smtp.username=xxxxxxxxx@gmail.com
mail.smtp.port=587
mail.smtp.password=
mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.timeout=120000
mail.smtp.host=smtp.gmail.com
mail.smtp.connectiontimeout=30000
14:37:56.684 INFO - Using data dir '/home/pi/Blynk'
14:37:59.110 INFO - Region : local. Host : 192.168.1.245.
14:38:00.992 INFO - Initializing gmail smtp mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
14:38:01.219 INFO - Reports : 0
14:38:01.222 INFO - Didn't find custom user certificates.
14:38:01.229 INFO - Didn't find Let's Encrypt certificates.13:32:33.052 INFO - Using data dir '/home/pi/Blynk'
13:32:35.962 INFO - Region : local. Host : 192.168.1.245.

Re du coup j’ai editer les fichiers comme indiquer dans la docs de blynk
mais rien ne semble pris en compte car de toute façon le fichier log du post précédent est en fin de compte un vieux fichier.
Donc je n’ai pas de log de Blynk.

Par contre je pense qu’il tourne comme un “service” ? non ?

pi@ServeurBlynk:~/Blynk $ ps -aux | grep java                                                                                                                                                     root       436  3.0  3.5 1181184 140100 ?      Sl   16:06   1:32 java -jar /home                                                                                                              /pi/server-0.41.11-java8.jar -dataFolder /home/pi/Blynk
pi        1057  0.0  0.0   7364   524 pts/0    S+   16:56   0:00 grep --color=au 

@+

Edited
Just added some notes for other people knowing what’s going on here,

  1. so I edit the files as indicated in the blynk docs but nothing seems to be taken into account

I suggest that you put the Blynk Local Server jar file in the same directory /home/pi/Blynk as all other *.properties files.

Currently, your jar file is at /home/pi, and your *.properties, dataFolder are all in /home/pi/Blynk from your command to start Blynk server:

java -jar /home/pi/server-0.41.11-java8.jar -dataFolder /home/pi/Blynk

It’s better you start over from reading README.md in

For example:
Create file mail.properties within same folder where server.jar is

in

Enabling mail on Local server
To enable mail notifications on Local server you need to provide your own mail credentials. Create file mail.properties within same folder where server.jar is. Mail properties:

    mail.smtp.auth=true
    mail.smtp.starttls.enable=true
    mail.smtp.host=smtp.gmail.com
    mail.smtp.port=587
    mail.smtp.username=YOUR_EMAIL_HERE
    mail.smtp.password=YOUR_EMAIL_PASS_HERE

You can also move all *.properties files out to /home/pi, but this is not a clean solution.

I’m afraid you have some confusion because the mistake in the above-mentioned README.md, such as

java -jar /home/pi/server-0.41.12-java8.jar -dataFolder /home/pi/Blynk &

in this paragraph suggesting you placing the jar file in home/pi, not in home/pi/Blynk

Enabling server auto restart on unix-like systems
To enable server auto restart find /etc/rc.local file and add:

  java -jar /home/pi/server-0.41.12-java8.jar -dataFolder /home/pi/Blynk &

If you move the jar file to /home/pi/Blynk, remember to change the command to

java -jar /home/pi/Blynk/server-0.41.11-java8.jar -dataFolder /home/pi/Blynk &

  1. If I understand correctly what you meant here:
    Is it normal for files to change ssh to not show up with registered items?
    est que c'est normal que les fichiers changer en ssh ne sont pas rafraîchit/afficher dans la page web de configuration de Blynk.

is it normal for files to change using SSH (Secure Shell) are not refreshed / displayed in the Blynk Server configuration web page.

That was answered in 1. because Blynk jar expects the *.properties files are in the same folder. Otherwise, it just uses the default version of *.properties files in memory, and pretending to save (actually saving to its Memory) and displaying V Save Changes. Certainly it’s not saving to not-found physical files.

If use use SSH to log and edit the files located in correct folder, everything will be refreshed / displayed / used after you restart the Blynk Server (kill-restart-jar, or reboot, etc.

  1. The old log files will be saved in an archive subfolder, where the file name is something like blynk.log.2019-12-05, and you can specify the level of logging to avoid using too much space by specifying which one you pick
#log debug level. trace|debug|info|error. Defines how precise logging will be.
log.level=error
#log.level=info
1 Like

Bonjour

Merci pour toutes ces informations !
J’ai déplacer le fichier server-0.41.11-java8.jar dans le dossier /home/pi/Blynk
j’ai également édité le crontab -e pour que blynk démarre à chaque reboot

Le fichier mail.properties est bien pris en compte maintenant

mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.host=smtp.gmail.com
mail.smtp.port=587
mail.smtp.username=xxxxxxxxxxxxxx@gmail.com
mail.smtp.password=xxxxxxxxxxxxxx
mail.smtp.connectiontimeout=30000
mail.smtp.timeout=120000

Mais Google ne semble pas vouloir utilisé cette appareil, j’ai eu ce mail de la part de google a l’envoi de DATA en csv depuis le téléphone portable ( signe que tout a été pris en compte ):

L'accès à votre compte par une application suspecte a été bloqué

xxxxxx@gmail.com

Google a empêché quelqu'un de se connecter à votre compte à l'aide d'une application n'appartenant pas à Google. Si ce n'était pas vous, cela signifie que quelqu'un d'autre connaît votre mot de passe. Nous vous conseillons donc de le modifier immédiatement.

Appareil non reconnu
Il y a 1 minute
À proximité de "xxxxx, France"

xx.xxx.xx.xxx (adresse IP)  *info*

J’ai indiquer que c’était bien moi en cliquant sur oui c'est bien moi mais il ne semble ne pas être d’accord :

Application moins sécurisée bloquée
Google a bloqué l'application que vous essayiez d'utiliser, car cette dernière ne respecte pas nos normes de sécurité.
Certaines applications et certains appareils utilisent une technologie de connexion moins sécurisée, ce qui rend votre compte plus vulnérable. Vous pouvez désactiver l'accès pour ces applications (recommandé) ou l'activer si vous voulez les utiliser malgré les risques encourus. Google désactive automatiquement ce paramètre s'il n'est pas utilisé.

j’ai modifier le port mail.smtp.port=587 en 465 mais idem…

Une idée ?

Re
Je répond a moi même…

Il faut autorisé l’accès aux applications moins sécurisé dans les parametre de sécurité de Google

et zouuu

@+

That’s good you found out and everything is OK now, I think.

The solution is to sign in using an App password

An App Password is a 16-digit passcode that gives a non-Google app or device permission to access your Google Account. App Passwords can only be used with accounts that have 2-Step Verification turned on.

More info can be found in

https://support.google.com/mail/answer/185833?hl=en

1 Like