SMTP Problems- Total Email Failure

SMTP Problems- Total Email Failure

by Mike Korn -
Number of replies: 40
I am in desperate need for a solution to our Moodle problem. I have asked our host -Sitegrounds - for help in the past, but no solution was ever offered. The automatic mail system in Moodle is not working anymore. In the past, the smtp host, username and password were left blank and there were no problems. We have since shifted our email host to Google Apps for Education. When smtp host is set to smtp.gmail.com (or any other smtp host is used for that matter) we get an error message:

ERROR: The following From address failed: username@host.com

Tried to send you an email but failed!

I get this error regardless of whichever smtp info I enter If smtp info is left blank, no errors - but no emails are sent. Our entire school depends on Moodle, is there any way you could possibly help with this situation? We are desperate.

Thank you in advance.

Mike
Average of ratings: -
In reply to Mike Korn

Re: SMTP Problems- Total Email Failure

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
I remember trying this a long time ago and getting an error because gmail uses ... tls? In any case, it is basically encrypted for security so I am not sure if you will be able to use gmail. I do not recall anyone successfully getting that to work. I ended up installing postfix on our production server and that has worked well. Best of luck and Happy Moodling!
In reply to Mike Korn

Re: SMTP Problems- Total Email Failure

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
Mike, this is only a guess - but GMail uses port 465 for outgoing SMTP mail instead of the normal SMTP port 25. You'll probably need to edit the port number in the lib files, perhaps class.phpmailer.php and/or class.smtp.php
In reply to Mike Korn

Re: SMTP Problems- Total Email Failure

by Denny Brown -
I am also a SiteGround customer. I'm having similar problems. The other responders might be right about the GMail problem. I'm trying to solve the problem of why the "normal" version suddenly stopped working. When did you first notice that the email had stopped working? ("normal" = blank entries in smtp host, username, pwd fields.)

There is more info on a similar thread that started last week.

-Denny
In reply to Mike Korn

Re: SMTP Problems- Total Email Failure

by Denny Brown -
I solved my problem. The solution is here. In my case, I left the smtp hosts etc. blank and used the normal email. I don't know if this will fix your original problem or not.

-Denny
Average of ratings: Useful (1)
In reply to Mike Korn

Re: SMTP Problems- Total Email Failure

by James Whitacre -
Mike,

Did you ever figure out the answer to this? We just switched over to Google Apps and now none of the mail is going out no matter what I try to set things at?

Need help asap!
In reply to James Whitacre

Re: SMTP Problems- Total Email Failure

by Steve McGuire -
Sorry if this is answered somewhere. I have looked and will keep looking.

I am having problems similar to the ones appearing here, but being new to all this, I'm not exactly sure where to look for answers. If anyone can point me in the right direction, I'd appreciate it.

I'm using Moodle on Siteground and my students all have e-mail accounts through Google Apps. I would like to be able to send them e-mail at their Google addresses from within Moodle, but get a variety of error messages and/or files sent to my administrator e-mail account.

I just tried it and part of the message reads "SITEGROUND: the domain in the Header From value doesn't not match any of the local domains."

From within Moodle I get...

ERROR: Could not instantiate mail function.

I have e-mailed Siteground and they tinkered with my settings but in the end said it was a problem through Google Apps.

Any and all help would be appreciated.

--Steve
In reply to Steve McGuire

Re: SMTP Problems- Total Email Failure

by Mark Miller -
I'm away from my home computer, so I may get some of the terminology wrong. Siteground will need to adjust your MPAD records. The correct settings are on the google apps web site. At least that's the way it's been explained to me in the past.

mark miller
In reply to Mark Miller

Re: SMTP Problems- Total Email Failure

by Steve McGuire -
Mark,

I'm actually _at_ my computer (well, at a lab computer), but I'll still probably get my terminology wrong anyway.

I _thought_ that I had sent all the required settings to Siteground and they checked a few times. I don't recall MPAD and couldn't find it.

What's probably goofing me up is Google Apps requires both authentification and use of a different port, and I guess Moodle isn't ready for that. If someone has done it succesfully, please let me know!

If it's still not possible, are there any other possibilities for using Mail through Moodle and getting mail sent to my domain at Google Apps? I am also trying to use FileMaker to send students feedback outside of Moodle, but it wants to use my default mail setting and won't let me change the "Reply to:".

All these potentially useful applications and I keep getting stuck. I'll keep at it. The Moodle community has sure been a great help.

--Steve
In reply to Steve McGuire

Re: SMTP Problems- Total Email Failure

by Chel Ramsey -
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.

In reply to James Whitacre

Re: SMTP Problems- Total Email Failure

by Gerald Grow -

Because people have ongoing problems getting Moodle to send out emails, I'd like to report some successes I've had.

Reminder: the settings in question are at Site Administration / Plugins / Message Outputs / Email.

There are four settings: SMTP Host, SMTP Security, SMTP Username, SMTP password. Ignore the other settings.

I have had some success with Moodle 2.5.6 and 2.8.6 on a Linux server.


(1) Use your host server's SMTP. This is desirable, because the originating Moodle and the sending mail program are housed on the same server. This lowers your email's spam score and makes delivery more likely.


Use settings like these (replace yourserver.com with the name of your domain):

SMTP host: mail.yourserver.com OR localhost OR the actual name of your server, something like host.yourserver.com. Try them till you find one that works. Ask your system administrator or hosting provider what to put here. It's probably the same thing you use in the settings to fetch your email from that server.

SMTP security: TSL preferred. SSL is OK. If those don't work, try None.

SMTP Username: This is a working email account on the server that hosts your Moodle. If you don't have one, create one something like support@yourserver.com. (Moodle directions on this point are unclear, I think.)

SMTP password: the password for that working email account.

Test, test, test! Log out, log back in, click the Forgot Username or Password link, and find out if you get a password-reset-confirmation email. You do not have to go to the next step and change the password. Keep track of which variables you have tested, then try the next one.


(2) Use an external SMTP mailer. I had success on one server with sendgrid.com -- but not on another server. Strange, but that's how it goes!

Let's assume you obtained a free account from sendgrid.com and they confirmed it. Use settings like these:

SMTP host: smtp.sendgrid.com:587

SMTP security: TSL

SMTP Username: username for your sendgrid.com account

SMTP password: the password for your sendgrid.com account


The failure of our Moodle installations to send out password-reset emails has been a major problem for us, but these settings seem to be working. I hope this posting helps someone.


In reply to Gerald Grow

Re: SMTP Problems- Total Email Failure

by Gerald Grow -

I will add some additional keywords and search terms here for the topic just above.

Password reset emails not delivered.

Confirmation emails

Moodle SMTP settings

Using an external SMTP server with Moodle

Followup: Our other server is, after all, sending emails properly with the settings above. This success has relieved us of a great deal of time spent reponding to student requests to have their passwords reset manually, because the automated procedure was being blocked by the receiving server.

Note that some university servers will automatically block any email that offers to reset a password. You may have to use the Customize feature in the language pack (under Site Administration) to change the message send to students so it does not mention "password".

It was hard to work out this solution, so I hope this summary saves someone the trouble.

In reply to Mike Korn

Re: SMTP Problems- Total Email Failure

by Ian McNaught -

My advice is don't use Google as your SMTP server!

Even if you manage to get it working, you have the 500 messages/day limit and the messages are all sent from the one email account, not from the original sender (both these issues are listed on http://docs.moodle.org/24/en/Email_setup_gmail)

Instead of using Google for SMTP I recommend using a service such as Critsend. It's not free, but incredibly cheap (and you get 50,000 mails for free to start you off). It will take you about 5 minutes to get Moodle setup to use critsend, and you get useful reports and statistics too (e.g. how many users open the emails sent).

We've used them for 2 years now, sent about 500,000 emails and not had any problems.

Average of ratings: Useful (2)
In reply to Ian McNaught

Re: SMTP Problems- Total Email Failure

by amit gupta -

Hey Ian,

Thnx for the advice but i am using moodle for demo website. Actually as i told you that my issue is partially solved. I am getting emails for new user registration and existing user profile modifications.

My problem is that i am not recieving any notification mails regarding course updates. 

Kindly lemme knw if u find anything related to this issue. a solution would be appreciable.

Thnx  in advnce.

In reply to amit gupta

Re: SMTP Problems- Total Email Failure

by Ian McNaught -

Hi Amit. Demo or not, I'd still recommend using something like Critsend instead of Gmail. It will literally take about 5 minutes to configure, as apposed to all the time you've spent trying to get Gmail to work. It may be a paid for service, but you get 50,000 mails for free to test it out, so for a demo site that should be ample. 

I'm not exactly sure what the notification emails are that you mention, but if it's something that Moodle is meant to send emails about then Critsend will deliver them.

In reply to Ian McNaught

Re: SMTP Problems- Total Email Failure

by Jose Roberto -

Hi Ian McNaught

Thx for this tip.

I am using Critsend and I heve a question:

How config critsend in moodle 2.5?

 

Thanks a lot

cristofani

In reply to Jose Roberto

Re: SMTP Problems- Total Email Failure

by Dhruva Maharaja D -

Jose,

I know it's been a while since you configured your emails using Critsend, but I just came across an email issue and found your post. Are you still using Critsend?

How did you configure Critsend with 2.5 and above?

Thanks.