BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blynk local server won't send email (setup issue)?

localserver

#1

First time setting up a local server on my raspberry pi 3, I got it up and running but am getting an error when sending an email token:

Notification error. Try again later

I have double checked my gmail app password is correct, i have 2 step authentication on as I couldn’t get one generated without it.

I have:
home/pi/server-0.41.3-java8.jar
home/pi/Blynk/mail.properties

mail.properties consists of:

mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.host=smtp.gmail.com
mail.smtp.port=587
mail.smtp.username=zzz@gmail.com
mail.smtp.password=xxxxxxxxxxxx

where zzz is my email edited to stop spam :slight_smile: and xxxxxxxxxx is my google generated app password.

I don’t have a server.properties file as I’m not sure if I need it/what to do.

Here is my log file

09:28:31.464 INFO - Using data dir '/home/pi/Blynk'
09:28:31.956 INFO - Region : local. Host : 192.168.1.95.
09:28:33.713 INFO - Initializing gmail smtp mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
09:28:34.609 INFO - Reports : 0
09:28:34.610 INFO - Didn't find custom user certificates.
09:28:34.615 INFO - Didn't find Let's Encrypt certificates.
09:28:34.615 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.
09:28:34.615 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.
09:28:36.563 INFO - HTTP API and WebSockets server listening at 8080 port.
09:28:36.568 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
09:28:36.570 INFO - Mqtt hardware server listening at 8440 port.
14:03:39.866 INFO - Using data dir '/home/pi/Blynk'
14:03:42.123 INFO - Region : local. Host : eth0.
14:03:43.737 INFO - Initializing gmail smtp mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
14:03:43.834 INFO - Reports : 0
14:03:43.835 INFO - Didn't find custom user certificates.
14:03:43.839 INFO - Didn't find Let's Encrypt certificates.
14:03:43.839 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.
14:03:43.839 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.
14:03:45.129 INFO - HTTP API and WebSockets server listening at 8080 port.
14:03:45.134 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
14:03:45.136 INFO - Mqtt hardware server listening at 8440 port.
14:28:44.099 INFO - Using data dir '/home/pi/Blynk'
14:28:46.280 INFO - Region : local. Host : eth0.
14:28:47.899 INFO - Initializing gmail smtp mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
14:28:48.010 INFO - Reports : 0
14:28:48.011 INFO - Didn't find custom user certificates.
14:28:48.015 INFO - Didn't find Let's Encrypt certificates.
14:28:48.015 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.
14:28:48.015 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.
14:28:49.397 INFO - HTTP API and WebSockets server listening at 8080 port.
14:28:49.402 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
14:28:49.404 INFO - Mqtt hardware server listening at 8440 port.
14:33:57.434 WARN - User 'zzz@gmail.com' not registered. /192.168.1.62:59643
14:34:00.551 WARN - User 'zzz@gmail.com' not registered. /192.168.1.62:59644
14:48:08.733 INFO - Using data dir '/home/pi/Blynk'
14:48:10.841 INFO - Region : local. Host : eth0.
14:48:12.432 INFO - Initializing gmail smtp mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
14:48:12.529 INFO - Reports : 0
14:48:12.530 INFO - Didn't find custom user certificates.
14:48:12.534 INFO - Didn't find Let's Encrypt certificates.
14:48:12.534 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.
14:48:12.535 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.
14:48:14.040 INFO - HTTP API and WebSockets server listening at 8080 port.
14:48:14.044 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
14:48:14.046 INFO - Mqtt hardware server listening at 8440 port.
14:50:16.894 INFO - Trying register user : zzz@gmail.com, app : Blynk
14:50:16.919 INFO - Registered zzz@gmail.com.
14:50:17.108 INFO - zzz@gmail.com Blynk-app (iOS-22500) joined.
14:50:17.722 WARN - Error sending greeting email for zzz@gmail.com.
14:52:06.976 INFO - Creating new dashboard.
14:52:07.463 ERROR- Error sending email auth token to user : zzz@gmail.com. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials o5sm16588254wrv.70 - gsmtp

14:53:37.853 ERROR- Error sending email auth token to user : zzz@gmail.com. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials n189sm2519335wmb.28 - gsmtp

14:55:25.800 INFO - zzz@gmail.com trying to reset pass.
14:55:25.802 INFO - Adding token for zzz@gmail.com user to the pool
14:55:25.810 INFO - Sending token to zzz@gmail.com address
14:55:26.141 INFO - Error sending mail for zzz@gmail.com. Reason : 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials u17sm29566704wrg.71 - gsmtp

14:56:26.902 INFO - zzz@gmail.com trying to reset pass.
14:56:26.902 INFO - Adding token for zzz@gmail.com user to the pool
14:56:26.903 INFO - Sending token to zzz@gmail.com address
14:56:27.268 INFO - Error sending mail for zzz@gmail.com. Reason : 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials y8sm7766836wrm.8 - gsmtp

14:57:52.309 INFO - Trying register user : zzz@gmail.com, app : Blynk
14:57:52.309 WARN - User with email zzz@gmail.com already exists.
14:58:01.930 INFO - zzz@gmail.com trying to reset pass.
14:58:01.930 INFO - Adding token for zzz@gmail.com user to the pool
14:58:01.931 INFO - Sending token to zzz@gmail.com address
14:58:02.340 INFO - Error sending mail for zzz@gmail.com. Reason : 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials s5sm24549512wra.77 - gsmtp

14:58:30.009 INFO - zzz@gmail.com Blynk-app (iOS-22500) joined.
14:58:39.491 ERROR- Error sending email auth token to user : zzz@gmail.com. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials f6sm10585680wrt.87 - gsmtp

15:01:19.703 ERROR- Error sending email auth token to user : zzz@gmail.com. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials m26sm1514349wmg.13 - gsmtp

15:04:53.688 ERROR- Error sending email auth token to user : zzz@gmail.com. Error: Couldn't connect to host, port: smtp.gmail.com, 587; timeout 30000
15:05:51.232 INFO - zzz@gmail.com Blynk-app (iOS-22500) joined.
15:06:07.650 INFO - Using data dir '/home/pi/Blynk'
15:06:09.911 INFO - Region : local. Host : eth0.
15:06:11.529 INFO - Initializing gmail smtp mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
15:06:11.627 INFO - Reports : 0
15:06:11.629 INFO - Didn't find custom user certificates.
15:06:11.633 INFO - Didn't find Let's Encrypt certificates.
15:06:11.633 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.
15:06:11.633 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.
15:06:14.077 INFO - HTTP API and WebSockets server listening at 8080 port.
15:06:14.081 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
15:06:14.082 INFO - Mqtt hardware server listening at 8440 port.
15:06:18.073 INFO - zzz@gmail.com Blynk-app (iOS-22500) joined.
15:06:35.884 ERROR- Error sending email auth token to user : zzz@gmail.com. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials e6sm9734126wrt.14 - gsmtp

15:08:17.612 ERROR- Error sending email auth token to user : zzz@gmail.com. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials b195sm5288014wmg.36 - gsmtp

15:11:29.809 WARN - User 'admin@blynk.com' not registered. /192.168.1.62:59796
15:11:43.014 INFO - admin@blynk.cc Blynk-app (iOS-22500) joined.
15:11:58.449 INFO - Creating new dashboard.
15:11:58.985 ERROR- Error sending email auth token to user : admin@blynk.cc. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials g2sm1569175wrh.7 - gsmtp

15:12:07.016 ERROR- Error sending email auth token to user : admin@blynk.cc. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials a14sm11164967wrx.96 - gsmtp

15:12:43.213 INFO - zzz@gmail.com Blynk-app (iOS-22500) joined.
15:14:12.703 ERROR- Error sending email auth token to user : zzz@gmail.com. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials 11sm2453004wmg.27 - gsmtp

15:17:43.477 ERROR- Error sending email auth token to user : zzz@gmail.com. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials c12sm10804469wrt.68 - gsmtp

15:18:06.608 INFO - Using data dir '/home/pi/Blynk'
15:18:08.756 INFO - Region : local. Host : eth0.
15:18:10.360 INFO - Initializing gmail smtp mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
15:18:10.457 INFO - Reports : 0
15:18:10.458 INFO - Didn't find custom user certificates.
15:18:10.462 INFO - Didn't find Let's Encrypt certificates.
15:18:10.463 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.
15:18:10.463 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.
15:18:11.899 INFO - HTTP API and WebSockets server listening at 8080 port.
15:18:11.903 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
15:18:11.905 INFO - Mqtt hardware server listening at 8440 port.
15:19:09.064 INFO - zzz@gmail.com Blynk-app (iOS-22500) joined.
15:19:15.630 ERROR- Error sending email auth token to user : zzz@gmail.com. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials g81sm3582984wmf.7 - gsmtp

15:19:53.027 ERROR- Error sending email auth token to user : zzz@gmail.com. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials c21sm13414631wre.35 - gsmtp

15:29:29.731 INFO - zzz@gmail.com Blynk-app (iOS-22500) joined.
15:29:31.469 ERROR- Error sending email auth token to user : zzz@gmail.com. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials d2sm10448757wrq.94 - gsmtp

15:29:51.683 INFO - Using data dir '/home/pi/Blynk'
15:29:53.809 INFO - Region : local. Host : eth0.
15:29:55.445 INFO - Initializing gmail smtp mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
15:29:55.554 INFO - Reports : 0
15:29:55.555 INFO - Didn't find custom user certificates.
15:29:55.559 INFO - Didn't find Let's Encrypt certificates.
15:29:55.559 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.
15:29:55.560 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.
15:29:57.016 INFO - HTTP API and WebSockets server listening at 8080 port.
15:29:57.021 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
15:29:57.022 INFO - Mqtt hardware server listening at 8440 port.
15:32:18.958 INFO - zzz@gmail.com Blynk-app (iOS-22500) joined.
15:32:21.217 ERROR- Error sending email auth token to user : zzz@gmail.com. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials m189sm2260292wmf.7 - gsmtp

15:39:11.221 ERROR- Error sending email auth token to user : zzz@gmail.com. Error: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials e12sm10292010wrs.91 - gsmtp


#2
mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.host=smtp.gmail.com
mail.smtp.port=587
mail.smtp.username=zzz@gmail.com
mail.smtp.password=xxxxxxxxxx

Add These lines?

mail.smtp.timeout=120000
mail.smtp.connectiontimeout=30000

#3

Wait… it says in your log you didnt have the server/contact names.

15:06:11.633 WARN - You didn't specified 'server.host' or 'contact.email' 

you gotta have those in your server.properties

on the email side… try going in and changing your app password again, getting a new one. two times is a charm


#4

Hi @Ivennard

Thanks for the help, so you think the server.properties is the problem.

You might have missed it in my original lengthy post :smile: "I don’t have a server.properties file as I’m not sure if I need it/what to do."

It is under advanced in the github help, so I thought I could do without it.

Could I use the example one ? It’s a lot of information!

Thank you :smile:


#5

#6

@Ivennard thank you!

I have it working now, would you mind checking all this is ok? (Although the github is excellent it can be confusing for newbies).

Files are like so:
(email address changed for post)

/home/pi/server-0.41.3-java8.jar
/home/pi/Blynk/myemail@gmail.com.Blynk.user
/home/pi/Blynk/mail.properties
/home/pi/Blynk/server.properties
/home/pi/Blynk/myemail.crt
/home/pi/Blynk/myemail.key

Autostart set in rc.local and crontab:

java -jar /home/pi/server-0.41.3-java8.jar -dataFolder /home/pi/Blynk -mailConfig /home/pi/Blynk/mail.properties -serverConfig /home/pi/Blynk/server.properties &

Contents of mail.properties

mail.smtp.starttls.enable=true
mail.smtp.host=smtp.gmail.com
mail.smtp.port=587
mail.smtp.username=myemail@gmail.com
mail.smtp.password=password

Contents of server.properties

server.host=my.email.com
contact.email=myemail@gmail.com
  admin.email=myemail@gmail.com
  admin.pass=password
allowed.administrator.ips=192.168.1.95/24
http.port=8080
https.port=9443
logs.folder=/home/pi/logs/
enable.db=false
log.level=info
restore.host=blynk-cloud.com
hardware.mqtt.port=8440
listen.address=
product.name=my_email
csv.export.data.points.max=43200
allow.store.ip=true
force.port.80.for.csv=false
server.ssl.cert=/home/pi/Blynk/myemail.crt
server.ssl.key=/home/pi/Blynk/myemail.key
initial.energy=100000

Latest addition to my log file:

17:14:37.371 INFO - Using data dir '/home/pi/Blynk'
17:14:39.759 INFO - Region : local. Host : my.email.com.
17:14:41.350 INFO - Initializing gmail smtp mail transport. Username : myemail@gmail.com. SMTP host : smtp.gmail.com:587
17:14:41.456 INFO - Reports : 0
17:14:41.461 INFO - Didn't find Let's Encrypt certificates.
17:14:41.461 INFO - Automatic certificate generation is turned ON.
17:14:42.066 INFO - HTTP API and WebSockets server listening at 8080 port.
17:14:42.069 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
17:14:42.071 INFO - Mqtt hardware server listening at 8440 port.
17:14:48.095 INFO - myemail@gmail.com Blynk-app (iOS-22500) joined.

I think that is all, any more advice would be great!

Thanks so far :smile:


#7
allowed.administrator.ips=192.168.1.95/24

Im sure this is fine… but my career is a network guy… so i have to correct you here or i wont be able to sleep tonight. :grinning:

for a single host you want a /32

allowed.administrator.ips=192.168.1.95/32

or for your whole network, you want to use the network number of Zero.

allowed.administrator.ips=192.168.1.0/24

===========

Right now, if someone attaches to your server, they can create an account, there is no acct creation blocking on the server today. The rest of us combat that by creating our own acct first, then setting the initial energy to Zero, so any new users are unable to use your private server.

initial.energy=0

After that, you should be good.
Good luck man!


#8

Thank you @lvennard !! I appreciate the help.

The github guide needs fixing clearly :smile:
“Comma separated list of administrator IPs. Allow access to admin UI only for those IPs. You may set it for 0.0.0.0/0 to allow access for all. You may use CIDR notation. For instance, 192.168.0.53/24.”

It’s all working fine but I would like to understand things a bit more, probably my lack of experience with linux is the barrier.

In particular I would like to understand the users element, how to change password credential and add/revoke users.

I’m sure it will become apparent with some reading :wink:

Thanks again