Search code examples
emailmoodlemailgun

How do I configure Mailgun for Moodle?


What is the proper configuration for Mailgun to be used with Moodle? I am using the Bitnami Moodle image on Google Cloud.

  • SMTP Hosts: smtp.mailgun.org

  • SMTP Security: none

  • SMTP Auth Type: Login

  • SMTP Username: [email protected]
  • SMTP Password: Aslistedintheaccountdetails

I receive this error message.

Error sending password change confirmation email

More information about this error

Debug info: Error code: cannotmailconfirm Stack trace: line 495 of /lib/setuplib.php: moodle_exception thrown line 110 of /login/lib.php: call to print_error() line 81 of /login/forgot_password.php: call to core_login_process_password_reset_request() Output buffer:

 2016-11-18 14:21:25    Connection: opening to smtp.mailgun.org:25, timeout=300, options=array ( ) 2016-11-18 14:23:32  SMTP ERROR: Failed to connect to server: Connection timed out (110) 2016-11-18 14:23:32 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 


Solution

  • Google Compute Engine does not allow outbound connections on ports 25, 465, and 587. By default, these outbound SMTP ports are blocked because of the large amount of abuse these ports are susceptible to.

    Port 25 outbound is blocked on Google Cloud. Mailgun mirrors 587, on port 2525 - so try using port 2525.

    As a quick test you could also try telnetting from the command line to check connectivity, like this:

    > telnet smtp.mailgun.org 2525