I am trying to run Blynk server on a local server
as the following command on my server on cloud.
> java -jar server-0.41.16-java8.jar -dataFolder /root/blynk -mailConfig /root/blynk/mail.properties
and this is my mail.properties
mail.smtp.starttls.enable=true
mail.smtp.port=587
mail.smtp.auth=true
mail.smtp.host=smtp.gmail.com
mail.smtp.username=example@gmail.com
mail.smtp.password=
And the blynk.log as the following
How to solve for setting mail for blynk local server ?
Thank you.
Enter your email address here. If you have enabled two step verification then you will have to give access to blynk. You can search the forum for more info on this.
1 Like
Thank you for the answer.
I have already set google account to Less secure app access
for my email account
And set my email / password to Blynk-Server’s mail.properties
like the following
mail.smtp.starttls.enable=true
mail.smtp.port=587
mail.smtp.auth=true
mail.smtp.host=smtp.gmail.com
mail.smtp.username=XXXXXXX@gmail.com
mail.smtp.timeout=120000
mail.smtp.password=XXXXXXXXXX
mail.smtp.connectiontimeout=30000
However when I pressed this email button
but it can’t send any email.
How to fix the problem?
Thank you.
Two things…
-
If you edit any of the .properties files in the Blynk admin portal then these changes aren’t saved to the file. You need to edit the file with a text editor and save it.
-
Changes to any .properties file aren’t applied until next time you start the server, so you need to do a restart after each change.
Other things to check…
Have you triple-checked your gmail password?
Is your server actually able to reach the gmail server? can you ping the server from your server?
What does your server log show after making these changes (please copy/paste rather than taking a screenshot)
Pete.
Thank you for the fast reply.
- If you edit any of the .properties files in the Blynk admin portal then these changes aren’t saved to the file. You need to edit the file with a text editor and save it.
- Changes to any .properties file aren’t applied until next time you start the server, so you need to do a restart after each change.
- File
mail.properties
, I used sudo nano mail.properties
to edit and save.
- As your advice, I have already restart the blynk server .
Is your server actually able to reach the gmail server? can you ping the server from your server?
I tried ping smtp.gmail.com
, the result as the following
What does your server log show after making these changes (please copy/paste rather than taking a screenshot)
File blynk.log
is shown like the following
(I don’t know how to use cloud as well,
sorry for the screenshot of blynk.log
)
I dont really remember properly, but the gmail will give an unique password for the “less secure app” to login. That must be pasted in the mail.properties. Not the one which we use normally for login.
If already done, please ignore this.
Hi, thanks for advice
Still can’t send email from app blynk.
When run the server,
which command to call
A.
java -jar server-0.41.16-java8.jar -dataFolder /root/blynk -mailConfig /root/blynk/mail.properties
or
B.
java -jar server-0.41.16-java8.jar -dataFolder /root/blynk -serverConfig /root/blynk/server.properties -mailConfig /root/blynk/mail.properties
Thank you.
If you put your .properties files in the same location as your server.jar file then you don’t need to specify the path.
It’s only necessary if they are in different locations or have different names.
Pete.
1 Like
When the blynk server start with mail config,
is it nessessary to add with -serverConfig
option ?
I don’t think you understood what I said last time.
My Pi server looks like this:
with the server.jar file and the mail & server properties files alongside each other in the /home/pi folder.
I start the server with this command:
java -jar /home/pi/server-0.41.15.jar -dataFolder /home/pi/Blynk
Pete.
1 Like
Hi,
I have already placed server.properties
and mail.properties
in the same folder
of server-xxxxx.jar
. And restart the server. However it still can’t send mail
This is the blynk-server’s blynk.log
13:22:14.815 INFO - Using data dir '/root/blynk'
13:22:16.808 INFO - Region : local. Host : 119.59.113.168.
13:22:16.931 INFO - Using native epoll transport.
13:22:19.579 INFO - Initializing gmail smtp mail transport. Username : ideaadvance.blank@gmail.com. SMTP host : smtp.gmail.com:587
13:22:19.687 INFO - Reports : 0
13:22:19.687 INFO - Didn't find custom user certificates.
13:22:19.690 INFO - Didn't find Let's Encrypt certificates.
13:22:19.690 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:22:19.690 INFO - Using native openSSL provider.
13:22:19.691 WARN - ATTENTION. Server certificate paths (cert : '/root/blynk', key : '/root/blynk') not valid. Using embedded server certs and one way ssl. This is not secure. Please replace it with your own certs.
13:22:22.009 INFO - HTTP API and WebSockets server listening at 8080 port.
13:22:22.020 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
13:22:22.022 INFO - Mqtt hardware server listening at 8440 port.
13:22:31.665 INFO - blynkgo@gmail.com Blynk-app (android-22728) joined.
13:22:40.420 ERROR- Error sending email auth token to user : blynkgo@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 y17sm11166859pfb.183 - gsmtp
13:23:58.724 INFO - Using data dir '/root/blynk'
13:24:00.994 INFO - Region : local. Host : 119.59.113.168.
13:24:01.171 INFO - Using native epoll transport.
13:24:03.673 INFO - Initializing gmail smtp mail transport. Username : ideaadvance.blank@gmail.com. SMTP host : smtp.gmail.com:587
13:24:03.779 INFO - Reports : 0
13:24:03.780 INFO - Didn't find custom user certificates.
13:24:03.783 INFO - Didn't find Let's Encrypt certificates.
13:24:03.783 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:24:03.783 INFO - Using native openSSL provider.
13:24:03.783 WARN - ATTENTION. Server certificate paths (cert : '/root/blynk', key : '/root/blynk') not valid. Using embedded server certs and one way ssl. This is not secure. Please replace it with your own certs.
13:24:07.229 INFO - HTTP API and WebSockets server listening at 8080 port.
13:24:07.236 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
13:24:07.269 INFO - Mqtt hardware server listening at 8440 port.
13:24:17.274 INFO - blynkgo@gmail.com Blynk-app (android-22728) joined.
13:24:27.593 ERROR- Error sending email auth token to user : blynkgo@gmail.com. Error: 530 5.7.0 Must issue a STARTTLS command first. n30sm12173218pgd.8 - gsmtp
13:24:29.166 ERROR- Error sending email auth token to user : blynkgo@gmail.com. Error: 530 5.7.0 Must issue a STARTTLS command first. x13sm12371526pjl.22 - gsmtp
13:24:31.547 ERROR- Error sending email auth token to user : blynkgo@gmail.com. Error: 530 5.7.0 Must issue a STARTTLS command first. c191sm3371275pfc.94 - gsmtp
13:28:27.115 INFO - Using data dir '/root/blynk'
13:28:29.326 INFO - Region : local. Host : 119.59.113.168.
13:28:29.492 INFO - Using native epoll transport.
13:28:31.844 INFO - Initializing gmail smtp mail transport. Username : ideaadvance.blank@gmail.com. SMTP host : smtp.gmail.com:587
13:28:31.989 INFO - Reports : 0
13:28:31.990 INFO - Didn't find custom user certificates.
13:28:31.994 INFO - Didn't find Let's Encrypt certificates.
13:28:31.994 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:28:31.994 INFO - Using native openSSL provider.
13:28:31.994 WARN - ATTENTION. Server certificate paths (cert : '/root/blynk', key : '/root/blynk') not valid. Using embedded server certs and one way ssl. This is not secure. Please replace it with your own certs.
13:28:34.577 INFO - HTTP API and WebSockets server listening at 8080 port.
13:28:34.584 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
13:28:34.586 INFO - Mqtt hardware server listening at 8440 port.
13:28:35.692 INFO - blynkgo@gmail.com Blynk-app (android-22728) joined.
13:28:37.588 ERROR- Error sending email auth token to user : blynkgo@gmail.com. Error: 530 5.7.0 Must issue a STARTTLS command first. t7sm4926573pjr.29 - gsmtp
13:29:02.548 WARN - User 'blynkgo@gmail.com' credentials are wrong. /223.24.191.148:47826
13:29:19.763 INFO - blynkgo@gmail.com Blynk-app (android-22728) joined.
13:29:36.960 ERROR- Error sending email auth token to user : blynkgo@gmail.com. Error: 530 5.7.0 Must issue a STARTTLS command first. f14sm12759601pjq.50 - gsmtp
13:30:16.981 INFO - blynkgo@gmail.com Blynk-app (android-22728) joined.
What is wrong? And how to solve them?
Thank you.
Does your Gmail account use two-factor authentication? If so then you need to turn that off.
Have you tried copying and pasting the Gmail username and password from your mail.properties file into the Gmail login screen to ensure that they are 100% accurate?
Have you followed the ling provided:
https://support.google.com/mail/?p=BadCredentials
and gone through the steps it suggests?
Pete.
Thank you.
The Gmail accout , i created a new one that has normal login ( not two-factor authentication).
I have tried copying and pasting from my mail.properties file to Gmail login.
The username and password can login to gmail normally.
My cloud-computer that the blynk server is runing,
it doen’st has ssl now , the problem is come from ssl ?
I have just tried to start Blynk Server on my Windows10.
and config mail.properties with the save email account / password
and run the Blyhk Server with
java -jar server-0.41.16-java8.jar -dataFolder ./logs -mailConfig mail.properties
On Windows10, it can send mail by the blynk server
However when I try on the cloud ubuntu
with the same mail.properties and same command,
but it can’t send mail.
Any idea to solve the issue?
Thank you very much.
Maybe speak to your cloud provider and see if they are blocking traffic on port 587 ?
Pete.
As your advice, I have just tried to open port 587
However it still can’t send email.
I think you’ll find that’s for inbound traffic.
Some cloud providers block the usual outbound mail ports to prevent people using their servers for high volume email spam campaigns.
As I said, you should speak to them.
Pete.
1 Like
one way is to bypass the gmail problem. The app gives you the alternative of copying the token to the clipboard. Do that, then mail the token using whatever mail service you use to yourself and paste it into your sketch.