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

Local server e-mail authentication

I have set up a local blynk server and followed the instructions from the blynk server github for enabling mail and enabled less secure app access on the email acc I’m using to send mail from but when ever I try to send an email from the app i.e requesting auth tokens I get the following error in the log file

10:32:46.355 ERROR- Error sending email auth token to user : Myemail@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 u24sm2449574pgo.65 - gsmtp

My mail.properties file is as follows:
X denotes redacted info
mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.host=smtp.gmail.com
mail.smtp.port=587
mail.smtp.username=XXXXXXX@gmail.com
mail.smtp.password=XXXXX
mail.smtp.connectiontimeout=30000
mail.smtp.timeout=120000

Any help is greatly appreciated.

Is that all you get from the logs? No warnings about e.g. the certificates being wrong?

When i start the server i get the following

10:15:07.898 INFO - Initializing gmail smtp mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
10:15:07.972 INFO - Reports : 0
10:15:07.973 INFO - Didn't find custom user certificates.
10:15:07.974 INFO - Didn't find Let's Encrypt certificates.
10:15:07.974 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.
10:15:07.974 WARN - ATTENTION. Server certificate paths (cert : 'D:\Blynk server', key : 'D:\Blynk server') not valid. Using embedded server certs and one way ssl. This is not secure. Please replace it with your own certs.
10:15:08.849 INFO - HTTP API and WebSockets server listening at 8080 port.
10:15:08.850 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
10:15:08.851 INFO - Mqtt hardware server listening at 8440 port.

is that what you meant?

Yes! :slight_smile:

I’m somewhat guessing now since I don’t have my server up and running anymore. But I still have my setup notes! :nerd_face: Looking at those, I can see that I created my own certificates and specified server.host and admin.email in server.properties. I’d focus on the certificates without actually knowing! :smiley:

Total noob question but what would I put in server.host?

Hostname or (local) IP-number?!

So something like this
server.host=192.168.1.24
contact.email=XXXX@gmail.com

Yes!

I seem to be having an issue with what i put into the .properties files doesn’t stay there after server restart.

So I read through the readme on github a bit more and found a way to make it load the properties i want but when i started the server i got the following on the command line

Blynk Server 0.41.12 successfully started.
All server output is stored in folder 'D:\Blynk server\.\logs' file.
Generating own initial certificates...
Error during certificate generation.
Error creating new order :: Cannot issue for "192.168.1.24": The ACME server can not issue a certificate for an IP address

and the following in the log folder

13:31:11.858 INFO - Using data dir 'server-data'
13:31:12.178 INFO - Region : local. Host : 192.168.1.24.
13:31:12.484 INFO - Initializing gmail smtp mail transport. Username : xxxx@gmail.com. SMTP host : smtp.gmail.com:587
13:31:12.525 INFO - Reports : 0
13:31:12.525 INFO - Didn't find custom user certificates.
13:31:12.526 INFO - Didn't find Let's Encrypt certificates.
13:31:12.526 INFO - Automatic certificate generation is turned ON.
13:31:12.526 WARN - ATTENTION. Server certificate paths (cert : 'D:\Blynk server', key : 'D:\Blynk server') not valid. Using embedded server certs and one way ssl. This is not secure. Please replace it with your own certs.
13:31:13.513 INFO - HTTP API and WebSockets server listening at 8080 port.
13:31:13.513 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
13:31:13.514 INFO - Mqtt hardware server listening at 8440 port.
13:31:13.524 INFO - Starting up certificate retrieval process for host 192.168.1.24 and email xxx@gmail.com.
13:31:14.644 INFO - Registered a new user, URL: https://acme-v02.api.letsencrypt.org/acme/acct/83170027

The link in the log just gives and error


  "type": "urn:ietf:params:acme:error:malformed",
  "detail": "Method not allowed",
  "status": 405
}

I hate to triple post but I have solved the issue and want to sum up what I did incase anyone else has the same issue.

To force the server and mail properties create two files in the same dir as your servers jar file and name them server.properties and mail.proerties and past their respective configs with the settings you want and then when you start the server add -serverConf server.properties -mailConf mail.proerties

The server.host needs to be a publicly resolvable web address, I did this by simply adding an A record to my domains dns records and pointed it at my public ip.
I’m pretty sure you could get this to work with dynamic dns so you don’t have to own your own domain.

1 Like