OPNsense Forum

English Forums => General Discussion => Topic started by: rost on April 06, 2015, 10:52:58 am

Title: [SOLVED] system_advanced_notifications.php Could not send the message.
Post by: rost on April 06, 2015, 10:52:58 am
opnsense: /system_advanced_notifications.php: Could not send the message to username@mydomain.com -- Error: could not connect to the host "smtp.gmail.com": ??

How to debug this issue?
What is "could not connect"? Wrong password, wrong smtp serv, wrong port, ... ???
Title: Re: system_advanced_notifications.php Could not send the message.
Post by: AdSchellevis on April 06, 2015, 03:50:21 pm
Hi,

It might be that your firewall on the WAN site is blocking smtp traffic, the first thing you should check is if you have a rule on the wan interface allowing smtp (port 25) traffic to the outside world from your firewalls ip address.
If your firewall is open and it still doesn't work, you could test the connectivity from the box itself (using a ssh shell or terminal connection) by starting a telnet connection to gmail:

telnet smtp.gmail.com 25


It should say something like this :

220 mx.google.com ESMTP 12gaygddfasdf - gsmtp

Title: Re: system_advanced_notifications.php Could not send the message.
Post by: rost on April 06, 2015, 04:22:08 pm
Port Test Results   25

220 mx.google.com ESMTP jp18sm1021109lab.34 - gsmtp
Title: Re: system_advanced_notifications.php Could not send the message.
Post by: AdSchellevis on April 06, 2015, 04:42:59 pm
same error? is there any other lead in the log? It might be that gmail is blocking your mails (header issues), but I expect a little more info in the logs then.
Title: Re: system_advanced_notifications.php Could not send the message.
Post by: rost on April 06, 2015, 06:01:05 pm
opnsense: /system_advanced_notifications.php: Could not send the message to username@domain.com -- Error:
no more additional info in log

use
smtp.gmail.com  port 25
 STARTTLS
E-Mail auth username and E-Mail auth password
Title: Re: system_advanced_notifications.php Could not send the message.
Post by: AdSchellevis on April 07, 2015, 10:58:59 am
Found the issue, it's suppressing this warning:

Warning: stream_socket_enable_crypto(): Peer certificate CN=`smtp.gmail.com' did not match expected CN=`173.194.65.108' in /usr/local/etc/inc/notices.smtp.inc on line 609

I will push a fix later (we're in a release cycle at the moment, so git is currently frozen).

When this part is fixed, the log tells me "530-5.5.1 Authentication Required. Learn more a", and when putting in credentials for my gmail account google starts complaining about a untrusted client.
I guess when you change your gmail settings it will probably work.

Title: Re: system_advanced_notifications.php Could not send the message.
Post by: AdSchellevis on April 07, 2015, 09:22:53 pm
as promised, the fix (disable ssl peer validation, like it was in php5.5) is in https://github.com/opnsense/core/commit/9a0c07417f37524d22b42f6dc81efeaf404d125f
Title: Re: [SOLVED] system_advanced_notifications.php Could not send the message.
Post by: pcborges on April 20, 2017, 02:47:55 am
Hi, What do I have to do?
Do I change something on the src/etc/inc/notices.smtp.inc?
Do I have to replace the entire file?
Thanks
Title: Re: [SOLVED] system_advanced_notifications.php Could not send the message.
Post by: franco on April 24, 2017, 02:38:31 pm
You replied to a thread from two years ago. I'm assuming all the fixes reached version 17.1 so there is no need to manually do anything. Is there anything else in the logs that might help pinpoint this?
Title: Re: [SOLVED] system_advanced_notifications.php Could not send the message.
Post by: pcborges on May 03, 2017, 10:16:21 pm
Hi, I took some time to test the problem again.
I just installed a test PC with the OPNsense 17.1.5-i386
Set system/settings/notification as below:

server: smtp.gmail.com
port: 587
check Enable STARTTLS
sender: cyberwatchbr@gmail.com
destination: pcborges@yahoo.com
Email auth username: cyberwatchbr@gmail.com
Email auth pass: *****

This setup used to work well.
Now, when I click TEST SMTP I get no mail and the following log entry:

OPNsense opnsense: /system_advanced_notifications.php: Could not send the message to pcborges@yahoo.com -- Error: 534-5.7.14 EX4zifEE_WoNFn8Jfrfj4sQVPTi8TBcSEWDvtyxfFcF4w78dqVm8sCYWvDGxYvuxu4BkQW

Thanks
Paulo Borges