News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Anybody having recent issues with gmail?

Started by Dwev, January 03, 2018, 10:25:06 AM

Previous topic - Next topic

Dwev

I just can't get my G-Suite account to work with SMF.

I did both the edits to Sources/Subs-Posts.php and entered ssl://smtp.gmail.com with port 465 and the right mail address and password.
On top of hat I went into my G-Suite account en enabled to use less secure apps, but still no dice.
I'm testing this by going to members waiting for activation and sending reminders to an account I own.

Is there anyone that can help?
I really need this to work, the forum is going live soon and I definitely want to be using the Gmail-servers at that moment.

Shambles

Anything mail-related in your forum error log?

Dwev

Nothing that I can see (though the forum seems to generate a awful lot of errors, but that's for another thread, I guess).

Is the way I'm testing if the mail is working the right way?
(going to a specific member waiting for activation, and sending reminders)

Aleksi "Lex" Kilpinen

How about trying to send a newsletter to yourself? To the same address you are trying to use as the sender. That would at least tell you if you are able to get it to reach gmail in the first place.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

SaltedWeb

My own personal experiences with SMF, is   Gmail doens't play well with forums. And that Godaddy hosting doesn't play well with SMF.
Not that they are related but seems on the topics of errors people tend to have more problems with Gmail and Godaddy as causes for their problem.  I see you really want to use Gmail, but I can say using it in the past I had some very crucial emails going thru SMF that did not reach the people it should and it ended up costing me allot of money. I personally do not find it reliable to use of a forum because of its known spotty service this is not just SMF I had same issues with paid forum software like Xenforo.  Just throwing it out there as a side note to think about.
Knowing your limitations makes you human, exceeding these limitations makes you worthy of being human.

Aleksi "Lex" Kilpinen

Quote from: SaltedWeb on January 04, 2018, 01:15:41 PM
I personally do not find it reliable to use of a forum because of its known spotty service this is not just SMF I had same issues with paid forum software like Xenforo.  Just throwing it out there as a side note to think about.
It's not about the script sending the mails, it's about the server handling them really.
And a lot of other variables, like domains and receiving mail services, and spam filters and so on...
Forums can send out mail perfectly to large audiences, if everything works.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Dwev

Quote from: Aleksi "Lex" Kilpinen on January 04, 2018, 09:07:08 AM
How about trying to send a newsletter to yourself? To the same address you are trying to use as the sender. That would at least tell you if you are able to get it to reach gmail in the first place.

Tried this, no dice.
So I went back to the mail-options I had earlier (not Google, from the provider) and newsletters still don't get sent (I get a Gateway Timeout).

I'm trying to find if there are errors in the logs that point to the problem, but how do I recognise errors that are related to problems with the mail-function?

Aleksi "Lex" Kilpinen

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Dwev

@ Aleksi: didn't know about this script, thanks for pointing me to it!

Just tried it and it worked on both sides!!
So I guess this means that the mail is working, but the Newsletter isn't.

I'll test the same script with the settings for Gmail, would be nice if that would work as well
(though I understand Gmail and SMF often don't really 'like' each other much).

Aleksi "Lex" Kilpinen

That tells us that your server can send mail, and the PHP option should work at least.
Then the next step would be to try and find out why the SMTP options you are using do not work.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Dwev

Quote from: Aleksi "Lex" Kilpinen on January 05, 2018, 08:23:59 AM
That tells us that your server can send mail, and the PHP option should work at least.

So some good news, but not good news all around, yes?

Quote
Then the next step would be to try and find out why the SMTP options you are using do not work.

Do you know how I can test this?

By the way, I just changed the settings to Gmail and again, success on both sides! :D

Aleksi "Lex" Kilpinen

No good ideas from me really, apart from what you yourself already mentioned - it should probably leave something in your logs when failing. I have never really tried to get gmail to work, as I have always found it easier to just create a local domain address and use the PHP mail functionality.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Jailer

I gave up on gmail a while ago and went with mailgun. Haven't had any issues since.

Dwev

Still trying to understand this, which leads me to the following question:

if the PHP-test worked with Gmail, can't I just choose PHP-mail instead of SMTP-mail in the Email-setting?

Aleksi "Lex" Kilpinen

You could, but that could end up causing more trouble since, as I understand it, you would be effectively forging the sender address. When you use that option, it is not actually sent through gmail.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Dwev

Quote from: Aleksi "Lex" Kilpinen on January 05, 2018, 06:13:56 PMWhen you use that option, it is not actually sent through gmail.

Hmm, so definitely not an option, not looking for forging anything of course.

Guess making sure that the SMTP option works is the only valid option...

Illori

if you use the php mail option to SEND to a gmail address using an email address that is on your domain there is no issue. if you want to SEND from a gmail address then you need to set up smtp.

Dwev

Quote from: Illori on January 05, 2018, 06:22:43 PMif you want to SEND from a gmail address then you need to set up smtp.

That's the option that I want to get to work.

Would be great if there was an easy option to check if it works (like with the PHP-script).

tinoest

I think you need to apply the changes I made to SMF2.1 for Gmail to work.

So go to Subs-Post.php and add this to the start of the smtp_mail function.



if (function_exists('gethostname') && gethostname() !== false)
$helo = gethostname();
elseif (function_exists('php_uname'))
$helo = php_uname('n');
elseif (array_key_exists('SERVER_NAME',$_SERVER) && !empty($_SERVER['SERVER_NAME']))
$helo = $_SERVER['SERVER_NAME'];

if (empty($helo))
$helo = $modSettings['smtp_host'];


Then find this

if (server_parse('EHLO ' . $modSettings['smtp_host'], $socket, null) == '250')

And replace with

if (server_parse('EHLO ' . $helo, $socket, null) == '250')

You might also need to add this after the above if statement.


// Send STARTTLS to enable encryption
if (!server_parse('STARTTLS', $socket, '220'))
return false;
// Enable the encryption
if (!@stream_socket_enable_crypto($socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT))
return false;
// Send the EHLO command again
if (!server_parse('EHLO ' . $helo, $socket, null) == '250')
return false;





Aleksi "Lex" Kilpinen

Quote from: tinoest on January 07, 2018, 12:55:14 PM
I think you need to apply the changes I made to SMF2.1 for Gmail to work.
Thank's - This I guess is due to Gmail being picky about the connections then :)
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Advertisement: