solved SMTP Errors with Google Apps (Gmail)

delete-me-please
delete-me-please
@markopolo
10 years ago
4 posts
Lately i've been using PHPMail() as SMTP isn't working on JR5. But I want to use SMTP instead (less chance of the email ending up in junk)

My domain already configured in google apps (admin.google.com)
- MX Records are correct
- SPF txt record is correct
- DKIM authentication dns record is added too

I went to Jamroom -> Communication -> Email Support
- Delivery Method: SMTP
- SMTP Host: ssl://smtp.googlemail.com
- Port: 465
- SMTP User Name: myname@mydomain.com
- SMTP Pass:  mypassword

Then i log out of admin, register on my own site as a test user.
I filled in all the details (even my personal hotmail.com account)

I clicked "Created Account".... After 2 seconds the ajax animation wheel stops, and i get a yellow error message that says:

"a system level error was encountered trying to validate the form values: error: Internal Server Error"

So I went back to jamroom admin, and changed this:
Before: SMTP Host: ssl://smtp.googlemail.com
After : SMTP Host: tls://smtp.googlemail.com
That didn't work either. So i tried this again:
Before: SMTP Host: tls://smtp.googlemail.com
After : SMTP Host: smtp.googlemail.com
Again, that failed.

So, to dig deeper, I went to check the php error log (jamroom/core/php_error_log) and it says this:
<span class="php_error">[02-Jan-2014 17:04:07] PHP Fatal error: Uncaught exception 'Swift_TransportException' with message 'Expected response code 250 but got code "", with message ""' in /......./modules/jrMailer/contrib/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php:386 [x 2]

<span class="php_">Stack trace: [x 2]

<span class="php_">#0 /......./modules/jrMailer/contrib/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php(281): Swift_Transport_AbstractSmtpTransport->_assertResponseCode('', Array) [x 2]

<span class="php_<mar...',">#1 /......./modules/jrMailer/contrib/swiftmailer/classes/Swift/Transport/EsmtpTransport.php(245): Swift_Transport_AbstractSmtpTransport->executeCommand('MAIL FROM: <mar...', Array, Array) [x 2]

<span class="php_<mar...',">#2 /......./modules/jrMailer/contrib/swiftmailer/classes/Swift/Transport/EsmtpTransport.php(327): Swift_Transport_EsmtpTransport->executeCommand('MAIL FROM: <mar...', Array) [x 2]

<span class="php_/......./modules/jrMailer/contrib/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php">#3 /......./modules/jrMailer/contrib/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php(416): Swift_Transport_EsmtpTransport->_doMailFromCommand('mar in /......./modules/jrMailer/contrib/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php on line 386 [x 2]


Right now, I've reverted to using PHPMail temporarily.
I don't want to keep using phpmail because it seems to keep failing SPF checks (according to thunderbird's email headers)

Google Apps, also requires TLS/SSL connections. So it won't accept regular http connections.


So, what do you think the issue is ? & what can i do about it ?.

Thanks.


updated by @markopolo: 02/02/14 10:56:25PM
brian
@brian
10 years ago
10,148 posts
Yeah this is not correct:

ssl://smtp.googlemail.com

the core does not know how to "handle" the ssl: (or tls:) prefix. Instead, you should just put in the domain:

smtp.google.com

and the PORT number. Now to be honest I'm not 100% sure that is even going to work with Google, as the SMTP setup was really designed to talk to an SMTP server that is in your control, not Google.

Let me know if that helps.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
brian
@brian
10 years ago
10,148 posts
I'm checking this out, and what is needed is a quick "test email" tool - I'll get something added into the Email module, as that would be helpful.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
brian
@brian
10 years ago
10,148 posts
Looks like in order to work with Gmail I will need to make an update to the module that forces it to use SSL over the transport - I'll get that updated and new version pushed out.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
delete-me-please
delete-me-please
@markopolo
10 years ago
4 posts
I just tried "smtp.google.com". That didn't work.
Also i tried the alternative port 587 (instead of the default 465). That didn't work too.

The php error log is the same as above ^ , except it says [x4] instead of [x2]

When you said you're going to make an update. Are you talking about the core or /mailer/ module itself ? & When is the update likely to be released?


Thanks
brian
@brian
10 years ago
10,148 posts
Just the mailer module - I've got to finish something else up here, but should have an updated mailer module out within an hour or so.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
brian
@brian
10 years ago
10,148 posts
A heads up that I'm running into unknown issues getting this working with Gmail - everything is configured and set according to the documentation, but trying to send an email always results in:

Swift_TransportException: Expected response code 250 but got code "", with message ""

I'm going to keep working on it to see if I can figure it out, but it's not moving very fast at this point.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
brian
@brian
10 years ago
10,148 posts
Okay this should be working now - I just updated the Marketplace with version 1.1.0 of the Mail Support module - it will now work with Gmail. It also has a new "Test Email" tool that lets you test your settings.

So go to your Marketplace -> System Updates and update the module, then you'll need to configure it:

SMTP Host: smtp.gmail.com
SMTP Port: 587
SMTP Username: (your gmail email address)
SMTP Password: (your gmail password)
SMTP Encryption: TLS

also you must go here:

https://accounts.google.com/UnlockCaptcha

and click on the button to allow 3rd party apps to send email through your Gmail account - by default it is blocked, which was part of the reason I could not get it to work.

Let me know if that works for you.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

updated by @brian: 01/02/14 01:55:39PM
delete-me-please
delete-me-please
@markopolo
10 years ago
4 posts
Hi,
I'm pleased to say it WORKS!! :D

I made a test registration, it worked.
I also used the "send test email" feature, it worked.

Yes, you're right about Google blocking 3rd party access, so if anyone else gets trouble in the future, they would need to visit that URL to allow access.

Thanks Brian
brian
@brian
10 years ago
10,148 posts
Glad to hear that is working - thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

Tags