Advertisement:

Author Topic: Anybody having recent issues with gmail?  (Read 1764 times)

Offline Dwev

  • Jr. Member
  • **
  • Posts: 223
Anybody having recent issues with gmail?
« on: January 03, 2018, 10:25:06 AM »
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.

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,204
  • Gender: Male
    • i30 Owners Club
Re: Anybody having recent issues with gmail?
« Reply #1 on: January 03, 2018, 10:41:35 AM »
Anything mail-related in your forum error log?

Offline Dwev

  • Jr. Member
  • **
  • Posts: 223
Re: Anybody having recent issues with gmail?
« Reply #2 on: January 03, 2018, 11:02:17 AM »
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)

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,735
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: Anybody having recent issues with gmail?
« Reply #3 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.
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"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

Offline SaltedWeb

  • Sr. Member
  • ****
  • Posts: 861
  • Gender: Male
  • The Tired One
Re: Anybody having recent issues with gmail?
« Reply #4 on: January 04, 2018, 01:15:41 PM »
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.

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,735
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: Anybody having recent issues with gmail?
« Reply #5 on: January 04, 2018, 04:41:47 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.
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"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

Offline Dwev

  • Jr. Member
  • **
  • Posts: 223
Re: Anybody having recent issues with gmail?
« Reply #6 on: January 05, 2018, 07:36:07 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?

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,735
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"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

Offline Dwev

  • Jr. Member
  • **
  • Posts: 223
Re: Anybody having recent issues with gmail?
« Reply #8 on: January 05, 2018, 08:12:38 AM »
@ 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).

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,735
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: Anybody having recent issues with gmail?
« Reply #9 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.
Then the next step would be to try and find out why the SMTP options you are using do not work.
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"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

Offline Dwev

  • Jr. Member
  • **
  • Posts: 223
Re: Anybody having recent issues with gmail?
« Reply #10 on: January 05, 2018, 08:28:24 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

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,735
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: Anybody having recent issues with gmail?
« Reply #11 on: January 05, 2018, 09:23:41 AM »
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.
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"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

Offline Jailer

  • Jr. Member
  • **
  • Posts: 142
  • Gender: Male
    • Bored Guy Blog
Re: Anybody having recent issues with gmail?
« Reply #12 on: January 05, 2018, 05:12:48 PM »
I gave up on gmail a while ago and went with mailgun. Haven't had any issues since.

Offline Dwev

  • Jr. Member
  • **
  • Posts: 223
Re: Anybody having recent issues with gmail?
« Reply #13 on: January 05, 2018, 05:48:02 PM »
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?

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,735
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: Anybody having recent issues with gmail?
« Reply #14 on: January 05, 2018, 06:13:56 PM »
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.
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"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

Offline Dwev

  • Jr. Member
  • **
  • Posts: 223
Re: Anybody having recent issues with gmail?
« Reply #15 on: January 05, 2018, 06:19:13 PM »
When 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...

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 51,561
Re: Anybody having recent issues with gmail?
« Reply #16 on: January 05, 2018, 06:22:43 PM »
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.

Offline Dwev

  • Jr. Member
  • **
  • Posts: 223
Re: Anybody having recent issues with gmail?
« Reply #17 on: January 05, 2018, 07:17:34 PM »
if 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).

Offline tinoest

  • Development Contributor
  • Jr. Member
  • *
  • Posts: 246
Re: Anybody having recent issues with gmail?
« Reply #18 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.

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


Code: [Select]
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

Code: [Select]
if (server_parse('EHLO ' . $modSettings['smtp_host'], $socket, null) == '250')
And replace with

Code: [Select]
if (server_parse('EHLO ' . $helo, $socket, null) == '250')
You might also need to add this after the above if statement.

Code: [Select]
// 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;




Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,735
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: Anybody having recent issues with gmail?
« Reply #19 on: January 08, 2018, 05:18:18 AM »
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 :)
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"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

Offline Dwev

  • Jr. Member
  • **
  • Posts: 223
Re: Anybody having recent issues with gmail?
« Reply #20 on: January 08, 2018, 05:42:58 AM »
So go to Subs-Post.php and add this to the start of the smtp_mail function.

Before I start with this I want to be 100 percent sure.

The first bit of code should be added "to the start of the smtp_mail function", does this mean it should be added right after this?

Code: [Select]
// Send an email via SMTP.

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,542
  • Gender: Male
  • the "mods and tweaks" junkie
    • dopetalk
Re: Anybody having recent issues with gmail?
« Reply #21 on: January 08, 2018, 07:44:24 AM »
Sorry to butt in but this may help ... I manged to get this working after a code change ... see https://www.simplemachines.org/community/index.php?topic=556674

spooky ... the fix mentioned in there takes you back to April 03, 2016 to a thread called "Anybody having recent issues with gmail?"
The configuration of my Linux VPS (SMF 2.0 with 145 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Offline tinoest

  • Development Contributor
  • Jr. Member
  • *
  • Posts: 246
Re: Anybody having recent issues with gmail?
« Reply #22 on: January 08, 2018, 03:13:17 PM »
So go to Subs-Post.php and add this to the start of the smtp_mail function.

Before I start with this I want to be 100 percent sure.

The first bit of code should be added "to the start of the smtp_mail function", does this mean it should be added right after this?

Code: [Select]
// Send an email via SMTP.

No after the function bit. If you want to post your subs-post.php file. I'll manually edit it then upload it again.

Offline tinoest

  • Development Contributor
  • Jr. Member
  • *
  • Posts: 246
Re: Anybody having recent issues with gmail?
« Reply #23 on: January 08, 2018, 05:03:47 PM »
The attached modification should also work, I've not tested it but it looks ok.

Offline Dwev

  • Jr. Member
  • **
  • Posts: 223
Re: Anybody having recent issues with gmail?
« Reply #24 on: January 08, 2018, 05:25:55 PM »
@ aegersz: I did read probably all of the posts about Gmail on this forum, maybe I subconsciously copied that subject (definitely not on purpose!  ;)).

@ tiniest: the zip you posted was almost empty, so that didn't work (error starts with "Although the package was downloaded to the server it appears to be empty.").

But I'm adding my Subs-Post.php, if you can edit that one so that Gmail's SSL SMTP would work I would be much obliged!

Offline tinoest

  • Development Contributor
  • Jr. Member
  • *
  • Posts: 246
Re: Anybody having recent issues with gmail?
« Reply #25 on: January 08, 2018, 05:42:36 PM »

@ tinoest: the zip you posted was almost empty, so that didn't work (error starts with "Although the package was downloaded to the server it appears to be empty.").

It should contain two files, or atleast it does when I download it.

I'll look at the code tomorrow, most likely won't get round to changing it until later in the evening.

Ignore that, see the attached.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: Anybody having recent issues with gmail?
« Reply #26 on: January 08, 2018, 05:44:11 PM »
Depending on the tool used to make the zip file, SMF can barf on it thinking it is empty (when it clearly isn't)
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Dwev

  • Jr. Member
  • **
  • Posts: 223
Re: Anybody having recent issues with gmail?
« Reply #27 on: January 08, 2018, 05:46:44 PM »
There are indeed two files in it (install.xml and package-info.xml), but I think Arantor is right here, the Package Manager doesn't like the way it's made.

@ tiniest: I'll be patiently waiting for what comes my way, very happy already with all the help I'm getting! 

Offline tinoest

  • Development Contributor
  • Jr. Member
  • *
  • Posts: 246
Re: Anybody having recent issues with gmail?
« Reply #28 on: January 08, 2018, 05:49:29 PM »
There are indeed two files in it (install.xml and package-info.xml), but I think Arantor is right here, the Package Manager doesn't like the way it's made.

@ tiniest: I'll be patiently waiting for what comes my way, very happy already with all the help I'm getting!

Its tinoest or tino.

I just uploaded a copy which I think should work.

@arantor

It's probably as I did it on my mac, I seem to recall SMF not liking it when I used that due to the hidden files macOS add's.

Offline Dwev

  • Jr. Member
  • **
  • Posts: 223
Re: Anybody having recent issues with gmail?
« Reply #29 on: January 08, 2018, 06:22:10 PM »
Its tinoest or tino.

Sorry about that, I copied your forumname, but autocorrect changed it (good feature in general, with these kind of things really annoying).

Quote
I just uploaded a copy which I think should work.

I'll try it first thing tomorrow!

Offline Dwev

  • Jr. Member
  • **
  • Posts: 223
Re: Anybody having recent issues with gmail?
« Reply #30 on: January 09, 2018, 07:46:34 AM »
The short answer: it works!!!

The longer answer: after uploading the Subs-Post.php of tinoest is still didn't work.

So I went back to basics and first entered the non-SSL servers of my ISP: working fine.
Next the SSL-servers, everything working as well.
After that Gmail: still nothing.

So I logged onto the Gmail account and under "Apps with account access" I set the option "Allow less secure apps" to ON.
And lo and behold, it's working!!!

I have no clue if it would work without the edited file of tinoest, I hope you forgive me that I really don't want to try...   ;)