Emailing failed in Moodle 3.4.2 With SMTP Settings

Emailing failed in Moodle 3.4.2 With SMTP Settings

by Stephen Sockett -
Number of replies: 7
Hi,


First time poster, long time learner (sort of). 

I've been back and forth trying to get my Moodle instance (3.4.2) to send out authentication emails to new students. I couldn't do it through my hosting company as they seem to be rather strict about it all. I got G Suites and an paying for something that will allow me to use my email address with a Google SMTP server. When I run test emails I get this message:

2018-04-24 15:54:29	Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array()
2018-04-24 15:54:29	Connection: opened
2018-04-24 15:54:29	SERVER -> CLIENT: 220 smtp.gmail.com ESMTP o18-v6sm9577302oto.64 - gsmtp
2018-04-24 15:54:29	CLIENT -> SERVER: EHLO ehaccp.org
2018-04-24 15:54:29	SERVER -> CLIENT: 250-smtp.gmail.com at your service, [50.116.92.72]
                   	                  250-SIZE 35882577
                   	                  250-8BITMIME
                   	                  250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
                   	                  250-ENHANCEDSTATUSCODES
                   	                  250-PIPELINING
                   	                  250-CHUNKING
                   	                  250 SMTPUTF8
2018-04-24 15:54:29	CLIENT -> SERVER: AUTH LOGIN
2018-04-24 15:54:29	SERVER -> CLIENT: 334 VXNlcm5hbWU6
2018-04-24 15:54:29	CLIENT -> SERVER: c3VwcG9ydEBlaGFjY3Aub3Jn
2018-04-24 15:54:29	SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2018-04-24 15:54:29	CLIENT -> SERVER: U2lnbmU0MjIh
2018-04-24 15:54:29	SERVER -> CLIENT: 534-5.7.14  Please log in via your web browser and
                   	                  534-5.7.14 then try again.
                   	                  534-5.7.14  Learn more at
                   	                  534 5.7.14  https://support.google.com/mail/answer/78754 o18-v6sm9577302oto.64 - gsmtp
2018-04-24 15:54:29	SMTP ERROR: Password command failed: 534-5.7.14  Please log in via your web browser and
                   	                  534-5.7.14 then try again.
                   	                  534-5.7.14  Learn more at
                   	                  534 5.7.14  https://support.google.com/mail/answer/78754 o18-v6sm9577302oto.64 - gsmtp
2018-04-24 15:54:29	SMTP Error: Could not authenticate.
2018-04-24 15:54:29	CLIENT -> SERVER: QUIT
2018-04-24 15:54:29	SERVER -> CLIENT: 221 2.0.0 closing connection o18-v6sm9577302oto.64 - gsmtp
2018-04-24 15:54:29	Connection: closed
2018-04-24 15:54:29	SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

I have verified my password and user name to no avail.

I have no idea what to do at this point. Any help would be appreciated.

Thank you!

~Stephen Sockett

Average of ratings: -
In reply to Stephen Sockett

Re: Emailing failed in Moodle 3.4.2 With SMTP Settings

by Ken Task -
Picture of Particularly helpful Moodlers

Mind sharing what this is ... "am paying for something that will allow me to use my email address with a Google SMTP server."

That with provider ... ie, where you host the moodle?  or something recommended by the provider/hosting?  If it's something commercial then does whatever offer any FAQ's/Help pages for customers?   How about technical support for this 'something'?

'spirit of sharing', Ken



In reply to Ken Task

Re: Emailing failed in Moodle 3.4.2 With SMTP Settings

by Stephen Sockett -

Hi Ken,

Right you are. I was referring to G Suites for access to their MX records. Yes, I've read their FAQs and I am still totally out of luck. 

I host my Moodle instance with HostGator. They have pretty strict email policies regarding sending emails from apps.

Unfortunately, my hosting company is about as tier 1 as they get. I am hoping to tap someone on here that might have a clue and help me get this project moving on.

my site is www.ehaccp.org and the LMS is at www.ehaccp.org/haccpcertification

Have a great day!
~Stephen

In reply to Stephen Sockett

Re: Emailing failed in Moodle 3.4.2 With SMTP Settings

by Ken Task -
Picture of Particularly helpful Moodlers

HostGator is not alone ... none of them want to become the place of business for the 'next spam king'.

Don't host with HG myself ... so this is info gathering ... that you might have already seen/tried ....

Old forum posting:

http://forums.hostgator.com/sending-mail-using-external-smtp-t338219.html

Responses to posters having same issues there, did say HostGator folks had to 'whitelist' ... or other things to facilitate.

In looking at what you've provided ... this piece:

2018-04-24 15:54:29	CLIENT -> SERVER: EHLO ehaccp.org
2018-04-24 15:54:29	SERVER -> CLIENT: 250-smtp.gmail.com at your service, [50.116.92.72]

That IP address for 'your service' isn't the IP address of your server:

www.ehaccp.org.        1400    IN    CNAME    ehaccp.org.
ehaccp.org.        14400    IN    A    50.116.92.81

;www.ehaccp.org.            IN    A

;; ANSWER SECTION:
www.ehaccp.org.        1400    IN    CNAME    ehaccp.org.
ehaccp.org.        14400    IN    A    50.116.92.81

That 50.116.92.72 IP address (one shown in SMTP attempt to send from your Moodle) appears to be what your moodle server 50.116.92.81) is attempting to use to relay mail to Google's smtp.gmail.com server.

The .72 IP is:

;; ANSWER SECTION:
72.92.116.50.in-addr.arpa. 14400 IN    PTR    cloud182.hostgator.com.

So you might be on shared hosting?

Mx records for your domain, however, show:

;ehaccp.org.            IN    MX

;; ANSWER SECTION:
ehaccp.org.        14400    IN    MX    10 ALT4.ASPMX.L.GOOGLE.COM.
ehaccp.org.        14400    IN    MX    1 ASPMX.L.GOOGLE.COM.
ehaccp.org.        14400    IN    MX    5 ALT1.ASPMX.L.GOOGLE.COM.
ehaccp.org.        14400    IN    MX    5 ALT2.ASPMX.L.GOOGLE.COM.
ehaccp.org.        14400    IN    MX    10 ALT3.ASPMX.L.GOOGLE.COM.

Afraid you are going to have to work with HostGator on that one.

Now you did say you were paying for something ... but you didn't say, yet, what that was?

Not to try and confuse the issue more to an already confusing situation, but ...

There are services like SendGrid (offer a freebie but might have need of more volume/number of messages per month the freebie allows).   Believe or not, even Google's Compute Engine doesn't allow port 25 out/or in AND even if you host a Moodle by a FQDN on a GCE server, they recommend use of SendGrid ... other ... to relay mail.

'spirit of sharing', Ken


In reply to Ken Task

Re: Emailing failed in Moodle 3.4.2 With SMTP Settings

by Stephen Sockett -

Ken!!! You are amazing. This is the best news I've had in...days. Thank you. I'm on the phone with them as I type this message. I'll update you if it works or not. If it's as simple as making sure your web hosting company whitelists your cpanel to connect to remote SMTP then many people will be relieved that they are not clinically insane.

In reply to Stephen Sockett

Re: Emailing failed in Moodle 3.4.2 With SMTP Settings

by Ken Task -
Picture of Particularly helpful Moodlers

Uhhh .... I'd reserve getting hopes up too much ... did say the posting and response in the HG forums was old.   HG's may have 'changed their minds' or done something different by now.  But, let's hope, for your sake, it's that 'simple'.

Hmmmm .... as a former admin of many mail servers, often thought SMTP (Simple Mail Transport Protocol) was a mis-nomer ... may have started out 'simple', but was anything but 'simple' - unless one thought in terms of just transport ... cause a hacked mail server will certainly do that ... spew (transport) all over internet. :\

Fingers cross for ya.

'spirit of sharing', Ken


In reply to Ken Task

Re: Emailing failed in Moodle 3.4.2 With SMTP Settings

by Stephen Sockett -

LOL... hopes dashed ;(. I'm now on with Google. I'll let you know.