News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Email quit working

Started by jdgretz, April 13, 2021, 10:32:49 PM

Previous topic - Next topic

jdgretz

In the last day or so our system has quit sending out notifications, announcements, newsletters, etc.  Up to now, we had been using PHP for the email.  Working with Microsoft, we tried moving to SMTP (our email host is Microsoft Office 365) and still not getting anything to send.

Here is what I'm getting in the Error Log:

Type of error: General
http://socalpgr.org/pgr/index.php?action=emailuser;sa=sendtopic;topic=4734.0
Could not connect to SMTP host: 110 : Connection timed out

member John Gretzinger
Type of error: General
http://socalpgr.org/pgr/index.php?action=emailuser;sa=sendtopic;topic=4734.0

fsockopen(): unable to connect to smtp.office365.com:587 (Connection timed out)
File: /home/wzt5yswmnt1b/public_html/pgr/Sources/Subs-Post.php
Line: 1330

1329:      // Try to connect to the SMTP server... if it doesn't exist, only wait three seconds.
==>1330:      if (!$socket = fsockopen($modSettings['smtp_host'], empty($modSettings['smtp_port']) ? 25 : $modSettings['smtp_port'], $errno, $errstr, 3))
1331:      {
1332:         // Maybe we can still save this?  The port might be wrong.
1333:         if (substr($modSettings['smtp_host'], 0, 4) == 'ssl:' && (empty($modSettings['smtp_port']) || $modSettings['smtp_port'] == 25))
1334:         {
1335:            if ($socket = fsockopen($modSettings['smtp_host'], 465, $errno, $errstr, 3))
1336:               log_error($txt['smtp_port_ssl']);
1337:         }
1338:   
1339:         // Unable to connect!  Don't show any error message, but just log one and try to continue anyway.
1340:         if (!$socket)
1341:         {
1342:            log_error($txt['smtp_no_connect'] . ': ' . $errno . ' : ' . $errstr);
1343:            return false;
1344:         }
1345:      }


Mail type SMTP
SMTP server  smtp.office365.com
SMTP port  587
SMTP username  [email protected]
SMTP password ••••••••••••

If I change it back to PHP for mail type, the message goes into the queue and hangs there.

If I force sending the queue, it disappears from the queue but does not arrive in my InBox, nor does it show up in the Error Log.

Hosting is on Godaddy.

SMF version 2.0.18

Thoughts?

Thanks,

jdg

Ninja ZX-10RR

Quote from: jdgretz on April 13, 2021, 10:32:49 PM
Hosting is on Godaddy.
There's your issue right there. You'll find loads of topics about that garbage host randomly popping issues up...
Double check your SMTP details.

Also, try to upload a simple php test file in the forum root with this (upon filling it with meaningful email addresses):
<?PHP
$sender = 'yourwebmasteremailaddressgoeshere';
$recipient = 'yourpersonalemailaddressgoeshere';

$subject = "php mail test";
$message = "php test message";
$headers = 'From:' . $sender;

if (mail($recipient, $subject, $message, $headers))
{
    echo "Yay at least this works, and it means the problem is within SMF configuration somewhere";
}
else
{
    echo "Emails do not work globally, talk to your host";
}
?>

call it however you want, then try to run it by directly opening its URL. If you rename it "mailtest.php" then it will open at http://socalpgr.org/pgr/mailtest.php, assuming "pgr" is the forum subfolder where it's at.
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Steve

You might want to remove Ninja's file suggestion after you're done. I don't know if it will hurt anything to leave it or not but I personally don't like having test files in my forum folders when I'm done with them. :)
DO NOT pm me for support!

Ninja ZX-10RR

Huh, yes, indeed ;D Forgot ;D Thanks!
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

jdgretz

OK, an update - things still not working with either the PHP script or the SMTP configuration.  :(

However, I did find out why the PHP isn't working - we hit GoDaddy's hard limit on emails per hour and got blocked.  I'm currently in a time-out and waiting for the clock to run out.

Microsoft is working with me to figure out why the SMTP mail isn't working through their server.

The mailtest script works find, it's that GoDaddy is just dumping any emails coming from out application.

*sigh*

Looking for a new hosting service now.

jdg

Advertisement: