Outgoing Mail Confirmation **Error**

Outgoing Mail Confirmation **Error**

by makis paulidis -
Number of replies: 2

Hello, i am using Moodle Moodle 4.2 (Build: 20230424) and PHP 8.1.9 versions on a Linux system, the installation is dockerized in a VM.

I've got a problem when a user click the forgot password or when someone subscribes for first time, the confirmation email failed to send.

These are my configurations on the SMTP, i remove the mail due to  personal info but its correctly filled, the mail that is filled is a Gmail personal mail. and i get this error on testing: conf

2024-06-20 10:25:18	Connection: opening to smtp.gmail.com:587, timeout=300, options=array()
2024-06-20 10:25:18	Connection: opened
2024-06-20 10:25:18	SERVER -> CLIENT: 220 smtp.gmail.com ESMTP 5b1f17b1804b1-4247d0b63d4sm21028255e9.3 - gsmtp
2024-06-20 10:25:18	CLIENT -> SERVER: EHLO moocs-academy.slices-ri.eu
2024-06-20 10:25:18	SERVER -> CLIENT: 250-smtp.gmail.com at your service, [3.73.182.205]
                   	                  250-SIZE 35882577
                   	                  250-8BITMIME
                   	                  250-STARTTLS
                   	                  250-ENHANCEDSTATUSCODES
                   	                  250-PIPELINING
                   	                  250-CHUNKING
                   	                  250 SMTPUTF8
2024-06-20 10:25:18	CLIENT -> SERVER: STARTTLS
2024-06-20 10:25:18	SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2024-06-20 10:25:18	CLIENT -> SERVER: EHLO moocs-academy.slices-ri.eu
2024-06-20 10:25:18	SERVER -> CLIENT: 250-smtp.gmail.com at your service, [3.73.182.205]
                   	                  250-SIZE 35882577
                   	                  250-8BITMIME
                   	                  250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
                   	                  250-ENHANCEDSTATUSCODES
                   	                  250-PIPELINING
                   	                  250-CHUNKING
                   	                  250 SMTPUTF8
2024-06-20 10:25:18	CLIENT -> SERVER: AUTH LOGIN
2024-06-20 10:25:18	SERVER -> CLIENT: 334 VXNlcm5hbWU6
2024-06-20 10:25:18	CLIENT -> SERVER: [credentials hidden]
2024-06-20 10:25:18	SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2024-06-20 10:25:18	CLIENT -> SERVER: [credentials hidden]
2024-06-20 10:25:18	SERVER -> CLIENT: 535-5.7.8 Username and Password not accepted. For more information, go to
                   	                  535 5.7.8  https://support.google.com/mail/?p=BadCredentials 5b1f17b1804b1-4247d0b63d4sm21028255e9.3 - gsmtp
2024-06-20 10:25:18	SMTP ERROR: Password command failed: 535-5.7.8 Username and Password not accepted. For more information, go to
                   	                  535 5.7.8  https://support.google.com/mail/?p=BadCredentials 5b1f17b1804b1-4247d0b63d4sm21028255e9.3 - gsmtp
2024-06-20 10:25:18	SMTP Error: Could not authenticate.
2024-06-20 10:25:18	CLIENT -> SERVER: QUIT
2024-06-20 10:25:18	SERVER -> CLIENT: 221 2.0.0 closing connection 5b1f17b1804b1-4247d0b63d4sm21028255e9.3 - gsmtp
2024-06-20 10:25:18	Connection: closed
2024-06-20 10:25:18	SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting


Can you guide me to solve this?? Thanks in advance

Average of ratings: -
In reply to makis paulidis

Re: Outgoing Mail Confirmation **Error**

by Ken Task -
Picture of Particularly helpful Moodlers

Qualifications for this response: none - don't host on Amazon, but I can google! smile

Error says:

Username and Password not accepted.
SMTP connect() failed.
https://support.google.com/mail/?p=BadCredentials

Suggestions:

The noreply address should be a user right on your moodle server itself.
noreply@moocs-academy.slices-ri.eu

(above sendmail aliases)

Your moodle server IP address should be included in SPF records for your top level domain.  Would be best if one had all other: like DMARC and DKIM.
https://docs.moodle.org/404/en/Mail_configuration


Consider installing something like a Postfix localhost/send only MTA.
You'll have a mail server instance on your moodle server then and it keeps logs
that you could inspect to help troubleshoot this.

Also consider using Amazon recommendations/docs
https://docs.aws.amazon.com/ses/latest/dg/eb-relay.html
https://docs.aws.amazon.com/ses/latest/dg/send-email.html

Good luck!

'SoS', Ken