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: [email protected]
  • SMTP password: mypassword

How can I solve this error?

3
  • This is an issue with your Moodle setup, which is not a desktop app
    – random
    Jan 17, 2015 at 14:01
  • i'm not understanding by what you mean with "not a desktop app"
    – Noor
    Jan 17, 2015 at 15:23
  • What part of Moodle is a desktop app?
    – random
    Jan 17, 2015 at 17:40

1 Answer 1

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.

1
  • 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
    Jan 17, 2015 at 8:43

Not the answer you're looking for? Browse other questions tagged .