Email Notifications does not send out email

Hello everyone

I’m trying to setup temperature monitor that will email me when temperature reach set value, the code is working fine for Blynk Notification but I never receive any email.

Could anyone take a look the code below and let me know what missing or are there anything wrong with my local Rasberry Pi Blynk server?

//Email Notification 
    if (t >= 80 && notified == 0){ // check to see if flag is also set
    notified = 1; 
    Blynk.email("MyEmail@yahoo.com", "ALARM", "Temp is above 60F");
    Blynk.notify(String("WARNING: High Temperature @ New IT Room is now at: ") + t +("*F")) ;
    timer.setTimeout(120000L, resetNotified);   // Email notify every 2 mins 1800000L
    } 
    else if(t < 58){            // set lower than 60... to stop the 59.9-60.0 bouncing. 
    notified = 0;
    }
} 

  void resetNotified(){       //Email Notification
  notified = 0;               //Email Notification
  }                           //Email Notification

Have you configured and tested your mail.properties file and looked at your server logs when an email is sent?

Pete.

Hi Pete,

First, Happy Holiday to you and thank you for your prompt response

Yes, I did configured mail.properties as shown below.

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

I know the configuration is corrected as I do received an email when request for the Authorization Code

What else do I have to look for?

Pete.

where can I find the log in RPi, what directory is it?

I also noticed that I can’t access my local Blynk website anymore:

https://192.168.1.97:9443/admin

It shown “This site can’t be reach”

/home/pi/logs

is 192.168.1.97 the IP address of the eth0 interface of your Pi?

Pete.

“192.168.1.97” is my IP address for eth0 on my LAN port

Here is what I found in the Blynk.log

13:44:37.194 INFO - MyEmail@yahoo.com hardware joined.
14:44:17.309 INFO - Using data dir '/home/pi/Blynk'
14:44:21.850 INFO - Region : local. Host : 127.0.1.1.
14:44:23.236 INFO - Initializing gmail smtp mail transport. Username : MyBlynkServer@gmail.com. SMTP host : smtp.gmail.com:587
14:44:23.327 INFO - Reports : 0
14:44:23.328 INFO - Didn't find custom user certificates.
14:44:23.331 INFO - Didn't find Let's Encrypt certificates.
14:44:23.331 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:44:23.332 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:44:25.037 INFO - HTTP API and WebSockets server listening at 8080 port.
14:44:25.040 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
14:44:25.042 INFO - Mqtt hardware server listening at 8440 port.
14:44:26.460 INFO - MyEmail@yahoo.com hardware joined.

When I look at my server.properties file:

enable.db=true
enable.raw.db.data.store=true

I still can’t receive email from email notification or access the Blynk local web server but able to receive email with Authorization code fine, am I missing anything?

And at what time in the period covered by this server log did your hardware attempt to send an email?

Hopefully your server.properties file contains more than that. What’s the relevance of these two specific lines that you’ve shown here to this issue?

And, how have you configured the email widget in the app, plain text or HTML?

Pete.

enable.db=true
enable.raw.db.data.store=true

I don’t remember what are those file do as it has been few years.
This is all I have on my server.properties file. I think for some reason, all the data on that is gone. Can you let me know what do I need to put into that server.properties file?

I don’t configure the email on the app, all I have on the app is data virtual pin that display the data. Do I have to configure email on the app, how?

You have to add the email widget, in the same way that you have to add the notification widget. If you don’t have it in your project on the app then that’s your problem.

This is what a typical server.properties file looks like:

Pete.

Hi Pete,
I got email notification working after created the Widget in the app, thanks.

The only problems left is I can’t access the Blynk local website, properly due to missing info in server.properties file. Do I have to put everything from this “https://github.com/blynkkk/blynk-server/blob/master/server/core/src/main/resources/server.properties” into my sever.properties file?

That’s what a typical server.properties file looks like. The various parameters are explained on the Blynk GitHub page, so you can work through them if you have any issues.

Pete.

I have modified my Server.properties file as below and restart the Blynk but still can’t access the Blynk local website

enable.db=true
enable.raw.db.data.store=true

#hardware ssl port
hardware.ssl.port=8441

#hardware plain tcp/ip port
hardware.default.port=8442

#http and web sockets port
http.port=8080

#https and web sockets port
https.port=9443

#application ssl port
app.ssl.port=8443

Here is what the blynk.log show:

14:30:51.449 INFO - Using data dir '/home/pi/Blynk'
14:30:55.844 INFO - Region : local. Host : 127.0.1.1.
14:30:57.096 INFO - Initializing gmail smtp mail transport. Username : MyBlynkServer@gmail.com. SMTP host : smtp.gmail.com:587
14:30:57.193 INFO - Reports : 0
14:30:57.194 INFO - Didn't find custom user certificates.
14:30:57.198 INFO - Didn't find Let's Encrypt certificates.
14:30:57.198 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:30:57.199 WARN - ATTENTION. Server certificate paths (cert : '/home/pi/Blynk', key : '/home/pi/Blynk') not valid. Using embedded server certs and one way ssl. This is not secure. Please replace it with your own certs.
14:31:00.000 ERROR- Error initializing HTTP API and WebSockets, port 8080
java.net.BindException: Address already in use
	at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_65]
	at sun.nio.ch.Net.bind(Net.java:433) ~[?:1.8.0_65]
	at sun.nio.ch.Net.bind(Net.java:425) ~[?:1.8.0_65]
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[?:1.8.0_65]
	at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:130) ~[server-0.39.12-java8.jar:?]
	at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:558) ~[server-0.39.12-java8.jar:?]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1358) ~[server-0.39.12-java8.jar:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501) ~[server-0.39.12-java8.jar:?]
	at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486) ~[server-0.39.12-java8.jar:?]
	at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:1019) ~[server-0.39.12-java8.jar:?]
	at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:254) ~[server-0.39.12-java8.jar:?]
	at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:366) ~[server-0.39.12-java8.jar:?]
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[server-0.39.12-java8.jar:?]
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) ~[server-0.39.12-java8.jar:?]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462) ~[server-0.39.12-java8.jar:?]
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897) ~[server-0.39.12-java8.jar:?]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[server-0.39.12-java8.jar:?]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_65]
14:44:06.137 INFO - Using data dir '/home/pi/Blynk'
14:44:08.334 INFO - Region : local. Host : 127.0.1.1.
14:44:09.720 INFO - Initializing gmail smtp mail transport. Username : MyBlynkServer@gmail.com. SMTP host : smtp.gmail.com:587
14:44:09.812 INFO - Reports : 0
14:44:09.814 INFO - Didn't find custom user certificates.
14:44:09.818 INFO - Didn't find Let's Encrypt certificates.
14:44:09.819 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:44:09.820 WARN - ATTENTION. Server certificate paths (cert : '/home/pi/Blynk', key : '/home/pi/Blynk') not valid. Using embedded server certs and one way ssl. This is not secure. Please replace it with your own certs.
14:44:33.157 ERROR- Error initializing HTTP API and WebSockets, port 8080
java.net.BindException: Address already in use
	at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_65]
	at sun.nio.ch.Net.bind(Net.java:433) ~[?:1.8.0_65]
	at sun.nio.ch.Net.bind(Net.java:425) ~[?:1.8.0_65]
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[?:1.8.0_65]
	at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:134) ~[server-0.41.14-java8.jar:?]
	at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:550) ~[server-0.41.14-java8.jar:?]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1334) ~[server-0.41.14-java8.jar:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:506) ~[server-0.41.14-java8.jar:?]
	at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:491) ~[server-0.41.14-java8.jar:?]
	at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973) ~[server-0.41.14-java8.jar:?]
	at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:248) ~[server-0.41.14-java8.jar:?]
	at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:356) ~[server-0.41.14-java8.jar:?]
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) ~[server-0.41.14-java8.jar:?]
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) ~[server-0.41.14-java8.jar:?]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) ~[server-0.41.14-java8.jar:?]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[server-0.41.14-java8.jar:?]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[server-0.41.14-java8.jar:?]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[server-0.41.14-java8.jar:?]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_65]

As you’ve solved your original issue and started a new topic about your lack of access to the config portal I’m closing this topic and marking it as solved.

Pete.