SMTP Problems- Total Email Failure

Re: SMTP Problems- Total Email Failure

by Chel Ramsey -
Number of replies: 24
Hello. I run Moodle and my project uses the Gmail 'domains' service where we use Gmail as our email processor. IE: We have no email service on our server, we use Googles.

We run Moodle to train new developers/staff and so we needed the emails from the courses and Ask a Question type module.

I was able to get Gmail working under these conditions by doing the following:

In the Email section for smtp host I used: smtp.gmail.com
My @theseventhsungame.net email (Which again we use Gmail domains..)
The above email's password.


I then opened /lib/phpmailer/ and modified the following files:

class.phpmailer.php
around line 162

I changed var$Port =25; to 465

class.phpmailer.smtp
around line 30

I changed var $SMTP_PORT = 25; to 465

In the class.phpmailer.smtp file
around line 83

DIRECTLY after the Fucntion header, so the next line after the {
I added:
$host='ssl://' . $host;

I am now sending mail using the GMAIL feature.

http://www.theseventhsungame.net
http://www.theseventhsungame.net/tssuniversity

Hope that helps someone =)

Sincerely,
Chel Ramsey
admin@theseventhsungame.net


PS an additional step you may or may not need to take is to Un-comment the php_openssl.dll extension in php.ini I did not have to do this.





Average of ratings: Useful (3)
In reply to Chel Ramsey

Re: SMTP Problems- Total Email Failure

by Doug Brennan -
This should be added to docs or the smtp config page should have a port field and ssl option
In reply to Chel Ramsey

Re: SMTP Problems- Total Email Failure

by Barry O Reilly -
Thanks Chel,

I've been looking for an answer to this for days!
In reply to Chel Ramsey

Odp: Re: SMTP Problems- Total Email Failure

by adam banasiak -
It works!

Thanks
In reply to adam banasiak

SMTP Problems - Total Email Failure - Moodle 1.9.3

by Oswel Morales -
I'v been using moodle for 2 years, the 1.8 was excellent, no problem at all!!!!
But then, i "updated" to 1.9.3 and my phpmail thing doesnt work, so i start configure smtp and NOTHING!!!!

i did what i been reed on this forum, but nothing help me at all, im avarage person in coding, so i know where to go and what to do, but nope, i doesnt work for me.

I tried some many ways, like:

smtp.gmail.com:465
smtp.gmail.com:587
smtp.gmail.com
...

user@googlemail.com
...

"password"


Need some help on 1.9.3, i dont know what else to do, really its been like a week trying to get it.

In reply to Oswel Morales

Re: SMTP Problems - Total Email Failure - Moodle 1.9.3

by Alexander Holsteinson -
Oswald this PHPMailer of Moodle has some compatibility issues with PHP5.x since 4/2007 from what I have read and apparently is a bug that Moodle developers have not been able to fix

I am also dead in the water with the new user confirmation email failure in 1.9.4 stable and I checked today to see if it was discussed and assigned to a developer to fix but nope.... nothing surprise
In reply to Chel Ramsey

Re: SMTP Problems- Total Email Failure

by Jill Rochelle -

Question - when using this setup, in the emails sent from users, does their email address show up as the smtp email authentication that is being used here instead of their own email address?  If so, is that the way it is suppose to work?  If so, when a reply is done on an email, it never gets back to the one who sent the email.  Is there a workaround or bette solution without having to host your own mail server and addresses?  Does anyone else have this problem?

In reply to Jill Rochelle

Re: SMTP Problems- Total Email Failure

by Ulises Guerrero -
Hi Jill,

If you use gmail, that's how it works, it wont let you send from another address.

I'm almost to the point of having to host my own email server... But i'm thinking of hacking the code, to use Swiftmailer library and throttling so that you could use with shared hosting mail servers.

Would this help you ?

Regards,
Ulises


In reply to Ulises Guerrero

Re: SMTP Problems- Total Email Failure

by vin g -
Hello all moodler
i have done lot of work on moodle.
on email problem
i used yahoo mail pop account.
by little bit Rnd you can do that.
create a yahoo acct
put username and password in smtp user and password.
Attachment email.jpg
In reply to Ulises Guerrero

Re: SMTP Problems- Total Email Failure

by Jeff Wood -
Ulises,

I would be interested in known how your swiftmailer hack is coming. I'm on a shared host 9so is my wife) and throttling would be excellent.

Jeff
In reply to Jeff Wood

Re: SMTP Problems- Total Email Failure

by Roger Kenner -
I have found the solution, with a little help from the Siteground technical support. It is not all that obvious at first, but makes sense in the end.

One must set up at least one bonafide email account on the site, so as to be able to authenticate with Siteground's SMTP. (The native php method does not work, as cron.php does not have a sufficient level of permission to run it).

Assume a domain abc.com
an email account xx@abc.com
with password yyy

Here are the Email settings that matter:
SMTP hosts: abc.com
SMTP Username: xx@abc.com
SMTP password: yyy

(Now here's the tricky part!)
No-replay address: xx@abc.com ( I am not certain it must be the same, but it must be a bonafide email address on your domain.)
Support name: xx@abc.com ( I am not certain this field figures in the outcome)
Support email: xx@abc.com

Why these two other fields? Apparently the info from these fields (Default being: no-reply@domain.com and admin@admin.com) finds its way into the FROM: field of the mailer. But Siteground does not allow its SMTP to send out mail whose FROM: address is not a bonafide Siteground email address (I am not 100% certain it has to be from the same domain, but I would guess so.). Such a policy probably prevents people from using their SMTP to spoof other people's email.

This policy may have been somewhat recent. I seem to recall my Moodle on Siteground could and did sent out forum mail in the past. I did a workshop for beginners and came home to find tons of email messages from their forums. My support email address was one not on siteground. That is probably what killed it.

I hope this will help others.

Roger Kenner
Average of ratings: Useful (1)
In reply to Roger Kenner

Re: SMTP Problems- Total Email Failure

by Rob Hill -
Please confirm, Does this fix work on 1.9.7?

I have a gmail account and did the above fix but it is not working.
In reply to Roger Kenner

Re: SMTP Problems- Total Email Failure

by Jane Davies -

Hi Roger

I have followed your set-up instructions (using gmail account) and it seems to work fine if i'm logged in as the site administrator of moodle and post something on a forum.  If i login as a teacher of a course and do a post to a forum, it no longer emails the forum posts to the users - how do i get around this?

Regards

Jane

In reply to Roger Kenner

Re: SMTP Problems- Total Email Failure

by Simon Gee -
Hi Roger & Folks,

Funnily enough, I have had the same problem...I have posted on this in other places where I've included more detail. e.g. here - http://moodle.org/mod/forum/discuss.php?d=147470&parent=644805. I have also posted version information and stuff on my Profile.

It must be some bug...I've done exactly what you've described here Roger, and everything else I can find and nothing has worked...and I have had no replies to my pleas for assistance...

I even did Verbose Debug Reports and according to the report, backed by an interpretation from my host, as far as Moodle and the Host Server are concerned the emails are being sent without errors...I have no other error reports, including via the Site Error Report system...so I have nothing left with which to troubleshoot.

Unfortunately this issue effectively makes Moodle ineffective for our purposes. Unless this next install miraculously works, we'll probably have to ditch it...or opt for Manual Confirmations, which from our perspective is effectively the same thing...

I do appreciated all of your efforts in sharing this information and if I learn anything new I will definitely reciprocate.

Cheers

Stephen Glanville.
In reply to Simon Gee

Re: SMTP Problems- Total Email Failure

by Lindley Bailey -
This might apply if you are running on a virtual machine (VM).

I just read a CNET (?) article about running VM's and problems with the VM wrapper configuration files not properly mapping to the correct ethernet (eth0 or eth1) adapter.
So.. the VM (moodle) was able to talk to the internet through eth0 but unable to email through eth1 because the VM wrapper had instructions to route those two requests through different adapters.

Either you, or your provider, log into your VM and manually send an smtp email to you (so you know it went through). Does it go through? If yes, Moodle is not configured properly, if no, have support look at how smtp is handled in your VM.

Note: For your tech to help troubleshoot. The CNET problem was that the VM was set to talk to the eth1 as named by the manufacturer. But for admin simplicity someone had manually renamed the adapter on that physical box to a unique name, and this condition does not produce errors! Moodle thinks it was successful because the info left the VM, but the info never left the physical box.

Sincerely,
Lin Bailey
In reply to Lindley Bailey

Re: SMTP Problems- Total Email Failure

by Simon Gee -
Dear Lindley,

Thank you for your kind assistance.

I don't know if the server I am using runs on a VM, but having run out of troubleshooting options on this issue (I have been working on this for over a week now and have tried every hack and script edit I can find on the Moodle Docs, Forums and Bug Tracker sites and have even installed Moodle 1.9.8 on a completely different dormain...so that's 2 installations, 1 in a subdomain, 1 in it's own domain in a root install and both exhibiting the exact same problem...no confirmation emails), and have once again engaged the further assistance of my host administrators who have escalated my issue for further investigation.

My apologies for not replying sooner, but I've only just now found your reply because I physically visited this thread to check for updates. Unfortunately subscribing to a thread doesn't seem to help in tracking responses, as replies become obscured in the myriad posts to the Forum/Course topic (e.g. Using Moodle), and I have not yet discerned a manner of clearly tracking replies to specific posts/threads yet...

Anyway, I just wanted you to know that I have passed your information on to my host admin support guys, just in case smile.

At this stage I can only hope it is such a problem. Any problem would be good at this stage, as then I would then have something to fix. I'm getting no error reports and even verbose email and php debug reports indicate that all is working well.

Many thanks again.

Cheers

Stephen G



In reply to Simon Gee

Re: SMTP Problems- Total Email Failure

by Lindley Bailey -
I have trouble keeping track too. So I occasionally click on my name (upper or lower right) on moodle.org and then go to my posts, and look for anything new after it. Clunky, but it catches things I missed.

Good luck with your problems, sincerely,
Lin Bailey
In reply to Lindley Bailey

Re: SMTP Problems- Total Email Failure

by Simon Gee -
Hi Lin,

Hehe smile Yep! I've been doing the same smile

Re: My problems: As it happens, I think I've found the problem. I happened across this little thread yesterday - http://moodle.org/mod/forum/discuss.php?d=106021.

Though on face value it seemed a bit specific, after a week of troubleshooting I was up for trying unusual dances and even poultices if they worked smile

Turns out that's all it was...Spam filters...with the added twist of empty Spam Folders (apparently Google have recently given their Spam Filters bigger teeth).

Anyway, in case it helps anyone watching:

Until now, standard procedure has been to check Spam Folders on Public Email Servers (e.g. Google, Hotmail, Yahoo et al). But I'll be advising our students/teachers that to ensure visibility of Confirmation emails in the above mentioned server's Spam Folders, that they first either place an 'allow domain' filter in their account or pop 'noreply@your.moodle.domain' and 'admin@your.moodle.domain' into their Contacts list before they Submit their Registration.

Though I still think it's strange that I haven't encountered this problem of invisible 'Spam Emails' with any of my WordPress site's registration emails.

The only upside for me out of all this is that I've learned a lot more about Moodle in a short time than I would have otherwise... smile

Thanks again to all those that have tried to help and good luck smile

Cheers

Stephen G



In reply to Chel Ramsey

Re: SMTP Problems- Total Email Failure

by david zacarias -
Hi, im upgrading to 1.9.8, and cheking what i done for work with gmail, i found that i made this changes.

/lib/phpmailer/ and modified the following files:

----------------------------------------------------------------
class.phpmailer.php
around line 162

I changed var$Port =25; to 465
-----------------------------------------------------------------
-----------------------------------------------------------------
class.smtp.php
around line 30

I changed var $SMTP_PORT = 25; to 465

In the class.smtp.php file
around line 83

DIRECTLY after the Fucntion header, so the next line after the {
I added:
$host='ssl://' . $host;
-------------------------------------------------------------------

Be carefull

- Saludos desde México -


In reply to david zacarias

Re: SMTP Problems- Total Email Failure

by Wifred Jacquet Yeste -

Your solution has worked correctly in moodle 1.9.10. I have followed it strictly, as written above, and our smtp server, based on gmail apps account, awoke.

Thanks a lot.

In reply to Chel Ramsey

Gmail setup that worked for me in 1.9.8

by curt danforth -
The docs page that has this same info
http://docs.moodle.org/en/Email_setup_gmail
indicated to set the SMTP server to:
SMTP hosts: smtp.gmail.com:465

However I found that adding :465 in 1.9.8 after making the edits to the php files resulted in the SMTP service failing to connect.

It works without the port in the SMTP entry (makes sense given we set the port in the php already perhaps?)

Also the key for gmail seemed to also be in the post above by Roger Kenner related to setting the no-reply email to a valid gmail account. Thanks Roger

In reply to curt danforth

Re: Gmail setup that worked for me in 1.9.8

by E. L. Cooper -
Well I have the no reply set to a valid gmail account and attached is my edit of class.smtp.php I have tryed with and without the smtp port but I am still getting the error could not connect to smtp host so if anyone has any ideas I would appreciate it. I would hate to have to reconfigure a whole school's email.
In reply to Chel Ramsey

Re: SMTP Problems- Total Email Failure

by amit gupta -

Hey all,

Even i've encoutered this issue. I've tried all the things mentioned above but still no luck. I am getting this error:-

-----------------------------------------------------------------------------------------------------------------

SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)

The following From address failed: my_email_id@gmail.com

could not send email!

------------------------------------------------------------------------------------------------------------

Kindly let me knw about any working things.

 

Regards,

Amit

In reply to amit gupta

Re: SMTP Problems- Total Email Failure

by amit gupta -

This is to inform you all that my issue is partially resolved.
After making some smtp server settings as mentioned above, now i am able to receive user registration (confirmation mails) messages....but yet i am not receiving notification emails. 

Kindly let me knw anything if any one of u find anything related. It would be appreciable.