SMTP config to send mail

SMTP config to send mail

by James Steerpike -
Number of replies: 10
I have set up a new Moodle (3.4) on a unmanaged Ubuntu VPS but the SMTP configuration is giving problems. I have used a 3rd party SMTP server in the past and I thought it was easy. In Administration / Server / Email I set up SMTP Hosts username and password and so on following the 3rd party instructions. I tried this again and no emails were sent.  Sometimes I get "Error sending password change confirmation email" and sometimes no message at all.
 I also tried configuring a gmail account. This asks me to configure Settings > Site administration > Plugins > Message outputs > Email, a label which has an eye but can not be configured on my system. I have even tried installing a Postfix server and can confirm emails are sent from the command line. Have I missed a config step somewhere?
What log can I search for more clues?
Average of ratings: -
In reply to James Steerpike

Re: SMTP config to send mail

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Have you asked your hosting company if they provide an SMTP gateway you can use?

In reply to Howard Miller

Re: SMTP config to send mail

by James Steerpike -

I have an account on smtp2go which should be enough for my modest needs - usually passwords resets. They provide fairly clear instructions but  I am not getting emails sent.

My first attempt was with Sendgrid which I had already set up to send emails from another Moodle installation. I have also tried gmail so after 3 attempts I am starting to think the fault is not in the server.

In reply to James Steerpike

Re: SMTP config to send mail

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Have you used this hosting before? Do they allow emails to be sent to other email servers? Many sites block port 25 to discourage spammers.

In reply to Howard Miller

Re: SMTP config to send mail

by James Steerpike -

I am setting this one up on a new host. The install was fine and I have installed a Postfix server which has sent emails. Part of the problem is where to look - is it my host, smtp server selected or the Moodle configuration? Are there logs which can show  the problem? I will also raise a support ticket.

Also still confused by this

Configuring SMTP settings in Moodle
  1. Log into the Moodle Dashboard.
  2. Navigate to Site administration > Plugins > Message outputs > Email in the settings section.
  3. On the Email page, configure the SMTP settings. By default Moodle will use the PHP mail function to send emails.
I can't do this as I have  > Site administration > Plugins > Message outputs > Manage message outputs with an option of email which does not allow any change. This is 3.4.1 installed only a few days ago and this is what the documentation suggests to edit to set up gmail.

I have been setting up smtp under  Site administration > Server > Email  > Outgoing mail configuration. Am i missing a plugin?



In reply to James Steerpike

Re: SMTP config to send mail

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Site administration > Server > Email > Outgoing mail configuration.

Don't ever set up your own Postfix server or MTA. You are opening up a nightmare for yourself. 

I still come back to the original question you didn't answer - does your hosting company have an SMTP relay you can use?

In reply to James Steerpike

Re: SMTP config to send mail

by James Steerpike -

Checked  - those instructions do not apply to the latest version.

emails were under plugins in 2.8.

So I am configuring in the right place.

In reply to James Steerpike

Re: SMTP config to send mail

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Yes - they keep moving. Just to confuse people. Sorry - I meant, make things better wink

In reply to Howard Miller

Re: SMTP config to send mail

by James Steerpike -

It is an unmanaged server so I am on my own. Log files would be useful but I can't find anything useful in /var/log.

In reply to James Steerpike

Re: SMTP config to send mail

by James Steerpike -
I still can't get this to work.  I have configured php to work and this will send emails from my server so php is able to send emails.
echo "This is the body of the email" | mail -s "This is the subject line" your_email_address
 I have been testing by asking for a password reset but I get an error/moodle/cannotmailconfirm message. I have tried setting the smtp config to blank defaults, to a gmail address and a sendgrid address. No emails are sent.

If myserver can send emails where is the problem?



In reply to James Steerpike

Re: SMTP config to send mail

by Peter Bowen -

Hi James,

I seem to be having a similar issue. The really odd thing is some things in the system send emails, and some don't. Specifically:

  • Backup summary email notifications come through each night (From noreply@xxx)
  • Face to Face (plugin) reminders come through (From noreply@xxx)
  • Face to Face (plugin) confirmations do not come through (no error)
  • Password reset requests do not work (generates error)
  • Forum emails come through (From noreply@xxx)

Would be interested to see if anyone else is having a similar issue.


Cheers

Peter