Unable to send emails through relay server

Unable to send emails through relay server

by Joel Mendoza -
Number of replies: 2

Hi, I've recently configured a moodle site for a customer where due to their internal polices, use a SMTP relay for email sending. They provided all parameters to configure outgoing email at Site administration  > server > test outgoing email config and indicated that server does not require authentication and works with any dummy email.

After complete configuration and try to test (using built-in test outgoing message feature) the result is an error showing: 

2022-09-19 13:34:41	SMTP Error: Could not authenticate.
2022-09-19 13:34:41	CLIENT -> SERVER: QUIT
2022-09-19 13:34:41	SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel
2022-09-19 13:34:41	Connection: closed
2022-09-19 13:34:41	SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

The weird thing is that when I use telnet to test email sending from server, everything goes well. 

Something similar happens when try to use one feature that needs to send email (self registration for new user):

Debug info:

Error code: auth_emailnoemail

Stack trace:
  • line 498 of /lib/setuplib.php: moodle_exception thrown
  • line 142 of /auth/email/auth.php: call to print_error()
  • line 99 of /auth/email/auth.php: call to auth_plugin_email->user_signup_with_confirmation()
  • line 92 of /login/signup.php: call to auth_plugin_email->user_signup()

Any idea?

Thanks, 

Joel

Moodle 3.9.1 (Build: 20200713)Cron executing every minute and log showing SMTP connect() failed




Average of ratings: -
In reply to Joel Mendoza

Re: Unable to send emails through relay server

by Ken Task -
Picture of Particularly helpful Moodlers

call to auth_plugin_email->user_signup_with_confirmation()

So there are 2 things ... site must allow users to use their email address when signing up (authentication) + the sending of the mail.   If first is not allowed, that is probably affecting the actual sending.

Best guess.

'SoS', Ken



Average of ratings: Useful (1)
In reply to Ken Task

Re: Unable to send emails through relay server

by Joel Mendoza -
Thanks Ken, your suggestion together with previous post helped to fix the issue which was related to SMTP relay authentication which was set with no login/password instead of "any dummy email address and no password". So, leaving email address blank in outgoing mail settings fixed it.
Best,
Joel.
Average of ratings: Useful (1)