Email not being sent from Moodle

0

I’m using Moodle where I allow user to register themselves, after which an email is sent to them. However, when user are registering, the email is not being sent and I’m getting the error:

Tried to send you an email but failed!

I have set the following SMTP details:

  • SMTP hosts: smtp.gmail.com
  • SMTP security: SSL
  • SMTP username: myusername@gmail.com
  • SMTP password: mypassword

How can I solve this error?

Noor

Posted 2015-01-17T07:01:48.817

Reputation: 266

Question was closed 2015-01-17T14:01:11.317

This is an issue with your Moodle setup, which is not a desktop app – random – 2015-01-17T14:01:11.317

i'm not understanding by what you mean with "not a desktop app" – Noor – 2015-01-17T15:23:56.100

What part of Moodle is a desktop app? – random – 2015-01-17T17:40:18.750

Answers

1

According to the official Moodle documentation, you need to make sure the correct port is set. Especially if you are using SSL:

Most SMTP hosts make use of the default port 25 to for listening email traffic. However, occasionally a non-default port is used. In such cases, entering an SMTP host followed by a colon (i.e. :) and the port number should work. For example, if my SMTP host is myemailserver.com and it listens on port 587 or 465 (most common) instead of port 25 I would enter the SMTP host as myemailserver.com:587.

Looking at the official Google document entitled “Google Apps SMTP settings to send mail from a printer, scanner, or app” shows more info such as the SMTP port for Gmail being 465.

So knowing those two bits of information it seems to me that you should be changing the SMTP host from this:

smtp.gmail.com

To this:

smtp.gmail.com:465

And try again.

JakeGould

Posted 2015-01-17T07:01:48.817

Reputation: 38 217

I put it as you said but still getting same problem, do you think this has got to do with PHP mail or any other configuraton on the server, because in my maillog, i'm seeing this: Jan 17 07:29:22 localhost postfix/sendmail[515]: warning: valid_hostname: invalid character 10(decimal): localhost.localdomain?server01 Jan 17 07:29:22 localhost postfix/sendmail[515]: fatal: unable to use my own hostname – Noor – 2015-01-17T08:43:46.777

I honestly have no idea what your question us now. Sorry can no longer help you. – JakeGould – 2015-01-17T09:53:08.780