Neither phpmail, nor smtp works (3.8.1)

Neither phpmail, nor smtp works (3.8.1)

by Murat Taşdemir -
Number of replies: 8

My moodle system (version 3.8.1) has stopped sending emails to users. When I test outgoing email configuration, it gives error. I have tried both phpmailer and an smtp configuration as instructed. I wonder if it is a moodle error or server error.

Cron job log has the following error message:

"Error: lib/moodlelib.php email_to_user(): SMTP connect() failed."

Average of ratings: -
In reply to Murat Taşdemir

Re: Neither phpmail, nor smtp works (3.8.1)

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Means, the SMTP server says No!

Why is that so, you will find out by reading the SMTP communication (debug) trace. The normal PHP debugging doesn't get them. You need SMTP debug.
In reply to Visvanath Ratnaweera

Re: Neither phpmail, nor smtp works (3.8.1)

by Murat Taşdemir -
Thanks for the suggestions. It turned out to be a server problem, and I have solved it. Now my moodle can send emails.

On the other hand, I am having problems with the "announcement forum messages". When I check forum subscribers, two admins/teacher are not in the list. They are registered to the class. This is true after deleting from, and reregistering them. The forum is set to mandatory subscription. There is no option to modify subscribers.
In reply to Murat Taşdemir

Re: Neither phpmail, nor smtp works (3.8.1)

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
What exactly was the "server problem". It is useful for the visitors here.

About the new question, please start a new thread. (Compare the subject line and the content to see why it is not a good thing drag on running discussions to new subjects.)
In reply to Visvanath Ratnaweera

Re: Neither phpmail, nor smtp works (3.8.1)

by Murat Taşdemir -
I do not know what was the problem with the server. I have limited access to the server. The admin just told me that she fixed a mail related issue with the server.

Thanks for the warning about the new question. I will start a new thread for that.
In reply to Visvanath Ratnaweera

Re: Neither phpmail, nor smtp works (3.8.1)

by Ivars Stivriņš -

First of all awesome software! Thanks a LOT! smile ++++ to karma!

but... have no luck of setting smtp auth to moodle... tried to use pear mailer on host , sends mail like a charm... but ... aaah...

no luck in setting php mail in moodle side... (this is my first 2 hours in experiance with moodle... but... all schools are closed due to corona... we have to set This awesome software during this night  smile ( have a lot of time still ) ... but ... php mailer not working

have own email server... but it does not even get a connection 

pear sends mail in 0.15 seconds....

SYSTEM (ubuntu 18.04.04)


In reply to Murat Taşdemir

Re: Neither phpmail, nor smtp works (3.8.1)

by Emily Calvo -

Same here, 7 hours trying to set it up and I am at my wits end.

In reply to Emily Calvo

Re: Neither phpmail, nor smtp works (3.8.1)

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
What did you do during those seven hours? So that we can continue from there. Or, do you want to start at square one?
In reply to Emily Calvo

Re: Neither phpmail, nor smtp works (3.8.1)

by Ken Task -
Picture of Particularly helpful Moodlers

@Emily

Moodle isn't a mail server ... never has been!

Much has to do with provider ... where you host.  Many providers do NOT want to become known as the 'AOL of old' - spammers haven.  Rackspace (a provider), for example, enters their own server IP addresses into blackhole list.

Providers actually block port 25 (typical SMTP port) both in and out of their entire network - Rackspace, as mentioned already, does, but so does Google's.

If, one uses default in Moodle, phpmailer, it will attempt to use sendmail ... see your servers PHP info page.  And probably fail.

Solution ... find an SMTP service ... (affordable, reliable, easy to set up and maintain ... that's not asking much, is it?)

Thus, check with provider first ... see if they offer an SMTP relay service you could use.

If not ... check out SendGrid.

https://sendgrid.com/

I don't get any kickback from recommending ... don't work for them ... also don't have much need of a lot of email traffic from Moodles ... other than confirmations and change of password or other such notices.  Do like simple ... API set up is pretty simple ... + Sendgrid takes care of SPF/DKIM etc. other DNS records.

My 2 cents!

'SoS', Ken