This forum is archived. Posts are preserved for historical reference. For current help, join us on Discord.

Gmail SMTP Mailer

In Documentation · Started by Brandin on 2017-01-05 5:03 pm · 85224 views · 32 replies

Hey guys!

FYI, if you are trying to use Gmail with the PHP mailer, you have to comment out line 115,
$mail->isSMTP();
or the mail will fail to send! Took me awhile to figure this one out!

Thanks.
That's weird. I have to take a look at that. I only use gmail on mine. Thanks for the tip!
It was very odd. I had to do some goggling with the error it provided me, and that was the result somebody came up with. I used the query "phpmailer error gmail smtp" or something like that. I'll look back and see what I can find and post it.
FYI:
users/helpers/helpers.php
around line 115 is where you edit this at.
This is the craziest thing @Brandin. I've been using this for months exactly like it was and all of a sudden I wasn't getting system emails. Commenting out line 115 fixed it. Crazy. You saved me a ton of time. THANK YOU!
No problem! Glad I could finally give you a solution ;) I struggled a lot because I use Google Apps, and my cPanel server was producing 550 errors when trying to use phpmail because technically the server didn't own the mail server as I used Google Apps, so I had to do some crazy changes, which I'll have to dig out and post! But yeah, I think it has to do with the only protocol on smtp.googlemail.com or whatever smtp.* URL you use, is SMTP, so defining a protocol can hurt it.
This same solution did help me on another hosted web project, with local smtp.

Comment out $mail->isSMTP(); in
users/helpers/helpers.php around line 115...

This same solution did help me on another hosted web project, with local smtp.

Evert
I fix all the google and FB email server, and I test end is good. next update userspice you will have nice interface :P
@Mudmin - did we deploy a "fix" for this if there is one? Can we do something about if the host == this we don't have that?
Do we know if commenting it out breaks it for non-gmail people?
Now this I don't know.......I've reverted from Gmail to a cPanel server and it is working fine.

You know whats funny.....you commented this out in the install files ;) So if everyone's mailers are working - then we are good to leave it out ;)
I'm sure we would have heard about it if it wasn't. :)

So it's just that it's never been pushed out as an update, right?
Nope...you pushed it :p

https://github.com/mudmin/UserSpice4/blob/master/users/helpers/helpers.php

Line 138
That's interesting because I use Gmail and I can only send out mail if I enabled SMTP. I wonder if the difference is because I'm using the business service and not a regular Gmail account?
I was using a Google Apps account too and it wouldn't let me......maybe it is server configuration related? I can't see this...but who knows! Are you using the newest version of helpers @Karsen? It would be commented out line 138?
I used a custom mail function. At the time I needed to use two different email accounts and they required different credentials so I modified it. I just tested the regular helper function with it commented out and it worked for me, so I have no idea why SMTP was required back when I first set it up!
Similar to @mudmin having used it for awhile and then all of a sudden it didn't work! So I'm thinking maybe this is a depreciated setting that breaks stuff now!
That's what I'm thinking. Something had to change on google's end.
@mudmin I'm going to have to explore this more

It seems to be server-based on if the SMTP mailer is going to work or not

On localhost, I connected to Gmail's SMTP server, had to uncomment the isSMTP() function as phpMailer wasn't on my localhost, and then when I deployed my repo onto my cP dev site, it failed and could not send, in which case I had to comment the line back out and revert to using the phpMailer.

Any idea on what might be causing this? Would it be something in my firewall do you think?
12Next ›