Forum not sending eMail - Cron is working

Forum not sending eMail - Cron is working

by Sandy deFerbrache -
Number of replies: 71
Greetings
Running the latest version of Moodle. When I first loaded the forums would send eMail - no settings have been adjusted and the cron is / was working. About 3 days ago the forums just stopped sending. Can someone give me some ideas here?
Thanks,
Sandy
Average of ratings: -
In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by Sandy deFerbrache -
I just tried registering as a new user to see if any mail was going out - the registration eMail WAS sent - so the program IS working. Just not the forums.
In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by William Claps -
I have the same problem Sandy.  Please let me know if you find a solution.  It happens no matter what version of moodle I use.  So I think it something in the permissions or roles that I have set up.  I think I'm going to experiment with a fresh install with a new database.  I'll let you know if it works.
In reply to William Claps

Re: Forum not sending eMail - Cron is working

by Joe Griffin -
I have a similar problem, cron is running and I get this message:
Could not instantiate mail function.

I posted a question about it on the General Problems forum because I also don't get email confirmation for new users.


In reply to Joe Griffin

Re: Forum not sending eMail - Cron is working

by IT Staff -

We get admin emails from moodle (backup and login error info) ok but the forum and "send message" emails don't even hit our SMTP server.  I can fully track the admin emails via Exchange Message Tracking.

The attached .php sends mail without a problem and the smtp host and from address are exaclty the same as my values in the Mail config of Moodle (verison 1.5).

So what do I look for to find out why forums won't send email?

In reply to IT Staff

Re: Forum not sending eMail - Cron is working

by John Isner -
Turn on debugging for email messages and see if it tells you anything. You must check two boxes:

Site administration -> Server -> Debugging -> check "Display debug messages"
Site administration -> Server -> Debugging -> check "Debug email sending"
In reply to IT Staff

Re: Forum not sending eMail - Cron is working

by Samuli Karevaara -
We have a more obscure version of this behavior: some forum mails are not being sent when the live cron is running. Sometimes some of the subscribers get the post, some don't. The mail cron doesn't seem to time out: I'm logging the cron action and there are no significant gaps in the time-line, no odd messages. Things seem fine.

But if I mark the mailed posts as "mailed = 0" and run the cron manually again, the posts always seem to mail out fine. Same on the test machine (though it's just simulating the mails).

Anybody else with similar symptoms?

I have to enable more logging, but logging everything e.g. all the queries from the "live action" produces a ton of stuff per second smile
In reply to Samuli Karevaara

Re: Forum not sending eMail - Cron is working

by Jeff McKune -
For a couple of months, we have been chasing a problem that appears as though forum posting email notification messages are not being sent. Some people receive them and some people don't. We were able to find some folks to help us with the diagnostics, and they found that the problem was related to the fact that Moodle sends "bare line feeds" (not preceded by a carriage return) in the notification email, which is against the SMTP email handling standards. Here is a link that describes the problem:

http://pobox.com/~djb/docs/smtplf.html

Here is a brief log entry (failed message) supplied by the diagnostic team, along with their comments when we told them notification worked with a Yahoo address:

2007-10-24 17:58:00.491020500 tcpserver: pid 11441 from 209.106.228.23
2007-10-24 17:58:00.491339500 tcpserver: ok 11441 server272.com:64.14.68.49:25 :209.106.228.23::35361
2007-10-24 17:58:00.719394500 11441 < MAIL FROM:<MoxleyD@health.missouri.edu>
2007-10-24 17:58:00.771704500 11441 < RCPT TO:<jeff@mckune.net>
2007-10-24 17:58:00.881997500 11441 > 451 See http://pobox.com/~djb/docs/smtplf.html.
2007-10-24 17:58:00.882001500 tcpserver: end 11441 status 256
=================================================

We are running QMail as a mail agent. Bare LFs are considered an error by this agent as they are violating the SMTP mail sending standards. Most likely Yahoo is using a different mail agent that is not considering this as an error. Please note that we can't change the behavior of QMail on our side. You will have to correct the format of the message that you are trying to send. You can also contact the developers of the software that you are using and notify them about the issue.

We are not sure how to fix our Moodle configuration to change this. It could be that it is something that needs be changed in the Moodle code. Would someone be able to help us with some direction on this?
In reply to Jeff McKune

Re: Forum not sending eMail - Cron is working

by Bruce Schmoetzer -
Please post this information (after searching to be sure there are no duplicates) to the Moodle Issue Tracker. If you don't already have one, you will need to get a new account on the Tracker. Since this is a core issue, it is definitely worth reporting.
In reply to Bruce Schmoetzer

Re: Forum not sending eMail - Cron is working

by Ellis Anders -
What intrigues me is the fact that at some point in time, the forum post e-mail notifications do in fact trigger in the "beginning". I have two test installations, a 1.6.2 server and a 1.7.1 server. On my 1.6.2 installation, I did trigger a mass e-mail due to a Site News post. Shortly thereafter, the functionality ceased to cooperate anymore.

On my 1.7.1 server, the manually run cron confirms the post being sent, but then ir evaporates before it can hit the SMTP host. If this "bare line feeds" is the issue, why the inconsistency in success? Wouldn't it fail every time? I sure i'm missing something...
In reply to Jeff McKune

Re: Forum not sending eMail - Cron is working

by Ellen Marie Murphy -
I think this would make sense if it didn't originally work, but like the original message posted in this forum, our forums and messages WERE once working. They suddenly stopped for no apparent reason. I don't even know where to begin looking. Our problem sounds exactly like the one at the very top of this forum

I turned on the debugging settings recommended above, but am not sure what to be looking for. I posted a message in a forum and manually ran the cron. The only message I saw, which was a new kind of message, was the following:
<div class="notifytiny" style="text-align:center">Error: Invalid context creation request for level "50", instance "8".<ul style="text-align: left"><li>line 1685 of lib/accesslib.php: call to debugging()</li><li>line 1844 of lib/accesslib.php: call to create_context()</li><li>line 174 of admin/cron.php: call to get_context_instance()


Not sure if that is related to email or not.
In reply to Ellen Marie Murphy

Re: Forum not sending eMail - Cron is working

by Dorothy Small -

This is frustrating, and agree, our email notifications for Forums worked well until the upgrade. I will be glad when this is solved.

In reply to Dorothy Small

Re: Forum not sending eMail - Cron is working

by Tonya Riney -

We've had to manually run the Cron multiple times with the upgrade.  Unfortunately have no solutions to offer. sad

Tonya

In reply to Samuli Karevaara

Re: Forum not sending eMail - Cron is working

by Arturo Israel García Castro -
We can send emails from forums messages they are delivered fine, but we have problems when sending confirmation emails they just dont arrive, We are using a MS Exchange server. What we have noticed in debuging mode is:

with forums
<moodlepost28@201.116.28.98> Queued mail for delivery

with confirmations
"250 2.6.0 <58d9f03696646c05eba68933fa4b27f7@201.116.28.98> Queued mail for delivery "

Them seem to be well delivered, but forums are the only one message that arrive.

What are the differences between sending forum messages and confirmation emails?



In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by Greg de Vitry -
Try repairing your forum table(s). Our emails stopped, I ended up here... eventually tracked down the cron job (tested with the next .x version... emails worked).
SELECT p.id, p.discussion FROM {$CFG->prefix}forum_posts p,
{$CFG->prefix}forum_discussions d
WHERE p.mailed = 0
AND p.discussion = d.id
AND d.timestart > '$now'
Returned: p is corrupt.

Looks like two days ago, the table became corrupted. Not sure why.

We are using mysql 5 (lamp). So repairing was easy. smile Re-ran the cron.php and 210 email went (40 of them were my test ones!).

Greg


Average of ratings: Useful (1)
In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by Steve Schellenberg -

I know this thread is working on two years old, but the topic/subject is the same now.

I was running v1.9.2 as a new instance where posts within the forums were emailing to subscribed users fine. Then stopped. A few have reported getting an email of posts from various forums, but for the most part, most are not.

Last weekend, I was reading where v1.9.3 may be having issues with emails not being sent so upgraded to: Moodle 1.9.4+ (Build: 20090204)

No luck. However, I have found that if I manually run Cron before the time to edit message runs out, the posts will send emails out to all subscribers.

I have another instance of Moodle v1.9.3 running and having no problems whatsoever.

Both installations are on a hosted service, same provider and near as I can tell, with the same server settings/configuration.

Anyone have any suggestions?

Thanks,
Steve

In reply to Steve Schellenberg

Re: Forum not sending eMail - Cron is working

by Steve Schellenberg -

Never mind.

After CAREFULLY looking at the command line for running the CronTab in Linux, I discovered the error to be a case of the wrong case. The "-o" should have been a "-O". When I changed it, the posts all email out fine now.

Thanks anyway.

In reply to Steve Schellenberg

Re: Forum not sending eMail - Cron is working

by Mike Korn -
Hi Steve,
Can you elaborate on your solution? We are running Moodle on an Ubuntu server and have the same problem.

thanks,

Mike
In reply to Steve Schellenberg

Re: Forum not sending eMail - Cron is working

by Carol Booth -
Not sure if my problem is related. Emails go to subscribers with gmail email accounts but not to subscribers with email on our own Zimbra server. Our mail server doesn't seem to even see the messages.

I'm sure cron is running (since some emails are going) Can anyone advise on this one, or how to track down the problem e.g. where can I find logs of failed attempts to send emails?

thanks
Carol
In reply to Carol Booth

Re: Forum not sending eMail - Cron is working

by ben reynolds -
Hi Carol,
If the situation is as you stated -- all emails with gmail accounts arrive and no emails on your own server arrive (are there any other email addresses & do they get mail? ) -- I would suspect that your Zimbra server thinks it is being spammed by Moodle, especially if the number of messages is fairly large.

In reply to ben reynolds

Re: Forum not sending eMail - Cron is working

by Carol Booth -
That sounds likely. We're new to running Zimbra as well so I'll have to figure out how to un-train it
Thanks
Carol
In reply to ben reynolds

Re: Forum not sending eMail - Cron is working

by Carol Booth -

Thanks Ben,

I found /var/log/mail.log and when I looked, I could see lines like:

Mar 16 17:00:01 ubuntu-server postfix/smtp[14168]: B0CE5BBC703: to=<a.user@wolsinghamschool.net>, relay=none, delay=0.17, delays=0.16/0/0.01/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=wolsinghamschool.net type=A: Host found but no data record of requested type)

I'm guessing this means that our internal A record for the Zimbra server is not correct.  Would this explain why mail reaches mail servers outside our network but does not reach the mail server on our network?

Carol

In reply to ben reynolds

Re: Forum not sending eMail - Cron is working

by Carol Booth -

Thanks Ben,

I found /var/log/mail.log and when I looked, I could see lines like:

Mar 16 17:00:01 ubuntu-server postfix/smtp[14168]: B0CE5BBC703: to=<a.user@wolsinghamschool.net>, relay=none, delay=0.17, delays=0.16/0/0.01/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=wolsinghamschool.net type=A: Host found but no data record of requested type)

I'm guessing this means that our internal A record for the Zimbra server is not correct.  Would this explain why mail reaches mail servers outside our network but does not reach the mail server on our network?

Carol

In reply to ben reynolds

Re: Forum not sending eMail - Cron is working

by Irma Gamez -

Hi!

It´s a long time ago but I´m having this problem with Moodle 1.9: "Zimbra server thinks it is being spammed by Moodle". The administrator network disabled all emails and now nobody can reset their password. ¿Can we just send emails for this issue and ignore the rest?

Thank you.

In reply to Steve Schellenberg

Re: Forum not sending eMail - Cron is working

by Victor Castro -
changing the "-o" to "-O" also worked for me. Now my forum email are being sent.
In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by Adam Sorensen -
under Notifications i saw something that said cron test has not run for 24 hrs. or something like that.
I clicked on it, ran test. All my email then showed up. Not sure if it was coincidental.
Now notification is gone so i cant tell you exactly what it said.


In reply to Adam Sorensen

Re: Forum not sending eMail - Cron is working

by ben reynolds -
Adam,
I'm 99% certain that "not run for 24 hours" essentially means the cron is not running on a regular basis. Your admin needs to follow the cron documentation to run the cron about every 10 minutes.
In reply to ben reynolds

Re: Forum not sending eMail - Cron is working

by Antonia Martinez -

THANKS! This solved my problem of my forum posts not sending email. And the instructions in the documentation for how to set the cron job were sooooo simple to follow. Hooray!

In reply to Adam Sorensen

Re: Forum not sending eMail - Cron is working

by Frank Muscara -
i was having the same problem and running the cron test worked for me. thanks.
In reply to Frank Muscara

Re: Forum not sending eMail - Cron is working

by Fahmy Babjee -

Our Moodle installation is experiencing a similar problem.

Forums within courses are working perfectly and emails get sent out with no problems and cron executes correctly.

However whenever there's a new post on the Site News of the front page, cron hangs at processing user...

In reply to Fahmy Babjee

Re: Forum not sending eMail - Cron is working

by Graeme Starke -

We have been getting similar problems with two sites - both the same moodle version (1.9.4) on the same server. We have had the server admin look at the chron and made adjustments (the capital -O instead of lower case) but still get the same result. Interestingly messages in the forums get sent to admin email accounts (external - two different admin accounts) but not to anyone else. Even when someone else posts the same thing happens - copies to admin accounts but not others (even the poster).

Is there some setting that could be causing this?

In reply to Graeme Starke

Re: Forum not sending eMail - Cron is working

by Graeme Starke -

After much testing we have solved our problem with this.

If the user has a role defined for the system (Users, Define Roles) then they will receive emails, even if they are defined as guest. If the role definition is done at the forum level itself it doesn't work - only when defined at the system level.

Hope this helps someone else.

In reply to Sandy deFerbrache

Additional information

by Brendan Blowers -
Hey everyone,

I had the same problem as you all for several months. The final solution I came to was to edit the cron job (as is mentioned previously in this thread). Anyway, here are the details of how I got the cron job working. Hopefully this will be helpful to others:


Issue: Moodle doesn't send out e-mail notifications when people post to the forum.

Details:

  • When a person is "subscribed" to a Moodle forum, they are supposed to receive e-mails automatically when other people post to that forum. This setting can be enabled/disabled by navigating to the forum as a teacher or admin, clicking "Show/edit" current subscribers, and turning editing on.
  • However, sometimes the users will not receive e-mails even if they are subscribed and people post to the forum.
  • (Note, this error may occur even though the registration and password confirmation e-mails ARE being sent out!)

Solution:

It may be that the "cron" job is not executing properly. You have to set it up to execute various times per hour. This is especially important if you migrated or copied the moodle installation from another folder/website!:
  • If you have shell access and server control, you can add a cron job by doing the following:
    • # crontab -e
      Edit the file that is opened by adding this line and changing the path.
      */5 * * * * /usr/bin/php '/var/www/website3/moodle/admin/cron.php' > /dev/null
      Restart the cron daemon just for good measure
      # cd /etc/init.d
      # crond restart

    • (Note: here are some other examples you can use in place of the line beginning with */5 * * * * above)
  • If you are using a hosting service (such as Godaddy) and didn't install moodle through the application manager, you can set the cron settings in your hosting control panel:
    • Log in and go to "My Account->Hosting->Manage Account->Content (dropdown box)->Cron Manager"
    • From here you can create a cron job with the following command:
Average of ratings: Useful (1)
In reply to Brendan Blowers

Re: Additional information

by William Megill -

Thanks for this! Finally explained what the problem is. Not that my ISP will let me fix it, but at least I know now why I can't!

I've come up with a workaround, which seems to solve the problem. Under the news forum link, I've created a URL resource, linking to

http://doesntexist.com/moodle/admin/cron.php

and not made it visible. Teachers can see the link, but students can't. So for the forums where it's one way communication, this solves the problem by adding two extra clicks to the news posting process. A bit of a bother, but for a small site, hopefully useful to someone.

In reply to Brendan Blowers

Re: Additional information

by Gary Lebowitz -

Hi, I saw your response a couple of years ago to this question and was wondering if you could help me with a GoDaddy command question. I have just installed Moodle 2.2.3 after upgrading to PHP 5.3, but using a command that worked just fine with I was using an older version of Moodle. That was: 

/web/cgi-bin/php5 "$HOME/html/moodle223a/admin/cli/cron.php"

The problem is that now I am using Moodle 2.2.3 and each time the cron job runs I get a message saying (erroneously, I checked to see what PHP version the system has) that I need to upgrade my PHP version to 5.3. I suspect there is something going on with the command I wrote, which must be updated to reflect the new installation. But I don't know how to do this. Any ideas you might agree to share on this? Regards

 

In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by Ruth Ruane -
Hi
I just wanted to share my solution to the cron working only manually with the result that but forum emails not being sent out automatically.
Emails stopped being sent out automatically without any setting changes being made.
One day things were fine and the next students weren't getting mails from the site.

There were no error messages when sending an internal message.
If I clicked forgot password that function worked ok as well.
The cron was checked and it seemed to be fine.
Every day I would have to manually run the cron and then mails would go out.
So today I went I logged into the server and I deleted the cron task.
Then I created a new but identical cron job.
Emails from forums and internal emails started sending automatically again.

I thought that it would be something that there would be no harm done it trying and it was very simple.

FYI here is how I did it.
I logged into my administration panel on my hosting server.
Then I found the place where the cron was set up.
I first copied the cron full url and pasted it in a notepad to keep it safe as it was a very long and complicated url.
Then I deleted the old cron task.
Then I created a new one and pasted in the old url and submitted the new cron task.

I hope I helped someone.
Regards,
Ruth
In reply to Ruth Ruane

Re: Forum not sending eMail - Cron is working

by P H -

Hello Ruth, 

I just wanted to thank you for helping solve a long-standing problem.

As advised by you, I deleted and recreated the cron instances and - Voila! - it all works like clockworks now! (Moodle 2.2.3)

Have a good morning/afternoon/evening! 

P. H. 

In reply to Ruth Ruane

Re: Forum not sending eMail - Cron is working

by jincy jose -

Hi,

I have the same problem with moodle 2.2.10.Mail is not sending to forum subscribers but mail is working for change password and sending message.As you told I tried to change the cron but there is no cron jobs in my hosting manager.What can i do?Can you help me?

In reply to Ruth Ruane

Re: Forum not sending eMail - Cron is working

by Ignatus Ujomor -

Hi Ruth,

You are amazing for sharing this!

Regards

Ignatus

In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by alireza kj -
Hi,
My problem is a little bit different. I could send messages to all students and when they are not online, they can get them via their emails. I mean the mail does work in this case. However, Nobody receive Forum posts via their emails. As I checked through my hosting server, it seems that Forum mail function does not work at all! But there is no errors.

Any suggestion would be appreciated.
Alireza.
In reply to alireza kj

Re: Forum not sending eMail - Cron is working

by Ratnesh Mathur -
IN my case the users (students) are gettgn the forum emails -
but i (an admin) who is also enrolled into this course (as admin) is not getting it
- must be something to do with permissions - can somebody guide me
In reply to Ratnesh Mathur

Re: Forum not sending eMail - Cron is working

by Maorong Zou -
I installed the stock ubuntu lucid moodle package (version 1.9.4). Forum email does not work. I was able to track down the problem.

 PHP Fatal error: Call to undefined function html2text()
 /usr/share/moodl /lib/weblib.php on line 2274 

Replace the line
 $result = html2text($html);
with
 $test = new html2text();
 $result = $test->html2text($html);

fixes the forum email issue.




Average of ratings: Useful (1)
In reply to Maorong Zou

Re: Forum not sending eMail - Cron is working

by Nathan Gilmore -
Maorong Zou - Thank You!

I can confirm that this worked for me too. I'm on the same design, ubuntu 9.04 and installed moodle via apt-get so I'm on 1.9.4 too.

What is your new code doing to fix this?
In reply to Sandy deFerbrache

Forum sending eMail only to one user - Cron is working

by Sara Valla -

Thread is working on many years old, but the topic/subject is the same now…
I read all interventions and followed suggestion but no solution.
And Moodle release is not 1.9 but 2.2.2.

Now I upgraded to Moodle 2.2.2+ (Build: 20120323) so problem is on that release… since nothing has changed
Apache/2.2.3 (CentOS)
MySQL client: 5.5.15
PHP Version 5.3.10

I use both CAS and local authentication and it works correctly.

I've got a problem with forum notification email.
I'm not able to identify the beginning of the problem, actually… it seems to me that it started about on 9th February 2012, when I upgraded from 2.1 to 2.2 but I'm not completely sure.

Roles are defined at system level (not at forum level).
Users do not receive mails at post sending inside forums even if they ARE subscribed.

I tried both with compulsory subscription and non compulsory subscription forums since I read that sometimes with previous Moodle releases that could be the problem but they behave the same.

What happens?
A post is inserted in the forum
mail is sent - cron runs correctly
If I also run it manually it shows it:
"sending post n"
"processing user n"
"12 users were sent post 333" and so on

… but actually only (one of) my user(s) receives mails.
I'm user id 3 in db, that is the first CAS user inside db (user 1 is guest, user 2 is a local admin I created at first).

I already looked around inside forums and Moodle Tracker platform but I didn't find any solution.

I found http://moodle.org/mod/forum/discuss.php?d=141218
I verified and my problem is different from those signalled there and solutions are not suitable for my issue


I also found: http://tracker.moodle.org/browse/MDL-30698
and I thought: "That's it. It seems to me that I've got the same problems with email notifications from forum.
Cron runs correctly, shows user processing and indicates that "n users were sent post idnumber" but only one user receives email notification."

I therefore modified file ../mod/forum/lib.php as suggested, but I didn't solve the problem.

I looked for mail problems as suggested in a post but I get

Mar 25 14:38:25 colab sendmail[32722]: q2PCcOk4032722: to="Sara Valla" <sara.valla@studenti.unipr.it>, ctladdr=sara.valla@unipr.it (48/48), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=142372, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (q2PCcO9b032723 Message accepted for delivery)
Mar 25 14:38:25 colab sendmail[32726]: q2PCcPZ4032726: Authentication-Warning: colab.cce.unipr.it: apache set sender to sara.valla@unipr.it using -f
Mar 25 14:38:25 colab sendmail[32726]: q2PCcPZ4032726: from=sara.valla@unipr.it, size=4362, class="-60", nrcpts=1, msgid=<moodlepost3453@colab.cce.unipr.it>, relay=apache@localhost
Mar 25 14:38:25 colab sendmail[32727]: q2PCcPbR032727: from=<sara.valla@unipr.it>, size=4557, class="-60", nrcpts=1, msgid=<moodlepost3453@colab.cce.unipr.it>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]

and it seems to me that it is ok...

I can't think of any other things to do and cannot solve the problem sad

Any further suggestions? Thanks in advance!

In reply to Sara Valla

Re: Forum sending eMail only to one user - Cron is working

by Stefan Nychka -

Hi.  Further diagnosis only

  • determine what's special about the one user that's receiving email.
  • Create a course with just 2 users, and play a bit ... ensure both profiles are correct, and emails are legit., and see what happens.

Can't remember where (a forum post in here), but some shots in the dark

  • on a user not receiving, disable, save, then re-enable (and save) their email.  See if that works.
  • Change the type of forum ... ensure just a standard forum works.

Some docs. that may be useful:

In reply to Sara Valla

Re: Forum sending eMail only to one user - Cron is working

by Chris Liang-Vergara -

Same problem here - created a new instance of 2.2.2, cron runs, personal messages get delivered, but nothing from forums or news feeds.  We're on Lunarpages.

In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by Jedidiah Rex -

Well, here I go adding to this immense thread. wink

A faculty member sent an email out of moodle, but it was not received for 44 hours.  The smtp server has no logs related to the time it was sent, but does have activity at the 44 hours later time that the message was received.  What might cause moodle not to communicate with the smtp server?  Note: the smtp server was receiving email from other senders during those times so there is no evidence that the smtp server was down in any way.

In reply to Jedidiah Rex

Re: Forum not sending eMail - Cron is working

by Dr. Nellie Deutsch -

Moodle 2.2.2 version is driving me crazy. Cron is working just fine, but no one is getting email notifications when they post to the discussion forums. I know that other admins of Moodle are having issues with this, too. Has anyone been able to resolve it?

In reply to Dr. Nellie Deutsch

Re: Forum not sending eMail - Cron is working

by Trevor Wilson -

Similar problem here.


Direct message works... course news forum works.... site news forums doesn't send mail (other than to me).

In reply to Dr. Nellie Deutsch

Re: Forum not sending eMail - Cron is working

by João Filipe Oliveira -

The same with 2.3

In reply to João Filipe Oliveira

Re: Forum not sending eMail - Cron is working

by Fabricio Braz -

Same problem! Has anyone solved it?

In reply to Fabricio Braz

Re: Forum not sending eMail - Cron is working

by panagiotis karageorgos -

I tried the solution described above by by Brendan Blowers

Cron is running in a programmar every 1 hour, and i m getting my emails  but they are characterized as SPAM.

As i can see there is another php script that sends automatically emails from forums or news and another for email messages.

I believe that someone some changes could be made there. 

In reply to panagiotis karageorgos

Re: Forum not sending eMail - Cron is working

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Characterising an email as spam is usually done at the receiving end, not where they are sent from. Check your own email settings and try adding the moodle address you are receiving them from (the spam ones) to your trusted receivers list

In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by Marlon Demos -

hello moodlers,

i'm stuck . I 've read a lot of things about thid problem but it doesn't work out.

My first issue is (and actual) on a Moodle 2.2.2+ (Build: 20120315) installation an hosted platform. 

Problem is users are not receiving mail. In the beginning admin-account received mail but at this moment nothing. I configured gmail as smtp and also edit the portnumber. But still no mail.

For now (because maybe i edited to much) i did an fresh installation from cpanel . Still no mail. Only mail was sent if the admin e.g. sent the user/studentaccount an private message. This is a  default installation.

Please, can someone help me with this? It is been over a few weeks i tried to resolve this with reading and editing but now i'm stucked

I tried de gmail smtp

Still errors, see the attachment.

 

If u need more information i can add this a.s.a.p. 

 

greetings

Marlon

In reply to Marlon Demos

Re: Forum not sending eMail - Cron is working

by Christian Chapi -

Try this:

If a new forum post is written, every subscriber gets an e-mail. If more than one person has subscribed to the forum, only one of all e-mails arrive. The problem was, that the mailserver identified them as "duplicate" because of the same "message-ID". So only the first mail was delivered. Looking into the code, this was clear....:

../mod/forum/lib.php line 602 (v2.1.2): 'Message-ID: <moodlepost'.$post->id.'@'.$hostname.'>',

The message-ID consists of the "post-ID"...
To have individual message-IDs, I just put the "userto-ID" into it as well: 'Message-ID: <moodlepost'.$post->id.$userto->id.'@'.$hostname.'>',

Now it works, every subscriber gets an e-mail.

I wonder if the behaviour of our mailserver is normal, but maybe this hint can help others too...

Average of ratings: Useful (1)
In reply to Christian Chapi

Re: Forum not sending eMail - Cron is working

by Gerrard Shaw -

I'm having the same problem, seems like the cron job only makes one request to send the mail - I'm watching my postfix /var/maillog file with tail and only see the first address appear (yet bizarrely it sends to multiple users on my test server)

The other site won't send forum messages at all despite saying in the cron it has, both servers were set up at the same time using the same OS version and Moodle configuration. 

Other emails send perfectly via the SMTP relay defined in postfix (cron job output etc) so getting to the point of wondering if it's something in the Moodle code being odd.

Also does this still apply? (found in another thread)

Moodle sends mail in two ways. If you do not specify an smtp server then it will use PHP's built in mailer. This just calls 'sendmail' on the server (which obviously needs to exist and be set up correctly). That either works or it doesn't (it's not a Moodle issue).

If you specify an smtp server it will use a mail library called 'phpmailer'. This simply initiates a conversation with your specified smtp server and relays all the mail there - anticipating that it will deal with it appropriately. This is usually the better choice and the only choice on Windows servers that do not have sendmail. Not *all* mail is sent from the cron job but, yes, most is.

I'm not really sure your question about mail being sent from the same server makes any sense. Mail is sent by code in Moodle so that's where it starts out. A send request is initiated by something in Moodle initiating the (Moodle) API calls that send mail. There's no magic.

In reply to Gerrard Shaw

Re: Forum not sending eMail - Cron is working - Forum hidden

by Julia Küfner -

I had a similar problem and found this post. It has probably nothing to do with the former posts but perhaps it is helpful for some people:A teacher had reported that his last forum entry was only received by one coursemember. It turned out that someone had accidentally hidden the forum. Therefore the message was only send to course members who had the right to view it. He was quite angry as moodle did not give him any hint that the forum was hidden and that not everyone will receive the message. I therefore proposed a change of the feedback text the teacher gets https://tracker.moodle.org/browse/MDL-43686 .

It was helpful to me to manually start cron via url. I waited about 30 minutes after the post and then startet cron manually. Receiving the following:

Processing module function forum_cron ...Processing user 11582
user 11582 can not see 2954
Processing user 6908
Sending post 2954: testnachricht
1 users were sent post 2954, 'testnachricht'
Starting digest processing...
Cleaned old digest records
... used 42 dbqueries
... used 0.130863904953 seconds
done.

Then it was obvious that the problem was within moodle configuration. The function that checks whether a user may see a message is:

mod/forum/lib.php forum_user_can_see_post

In reply to Julia Küfner

Re: Forum not sending eMail - Cron is working - Forum hidden

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

'He was quite angry as moodle did not give him any hint that the forum was hidden'

 

Attachment 2014-01-14_1217.png
In reply to Richard Oelmann

Re: Forum not sending eMail - Cron is working - Forum hidden

by Julia Küfner -

No sorry I mean the feedback text you receive. ( Your post was successfully added. You have 30 mins to edit it if you want to make any changes.(Continue))

I was actually surprised that forums still send emails when they are hidden.  But it is of course helpful for those using it to communicate just between teachers.

I think you can't expect from an ordinary teacher to understand the concept of hidden forums sending emails only to special users. Further more, you don't get any hint that the forum is hidden inside the forum and the feedback message gives you the feeling that everything is fine. And teachers don't get any further feedback or logfile where they could check if emails were actually send. Therefore I think from a usability point of view a short info in the already existing feedback text should be included to point out that the current forum state does not work behave like a standard forum.

In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by Nathan Revill -

I know that this is an old, old, old thread, but the title explains my problem exactly (well almost)

Settings:

Moodle 2.5 (it was upgraded from 1.9)

Cron is set to run every 5 minutes and is set to wget -q -O /dev/null and http://www.moodelsite.org/admin/cron.php

Forums are set to alert everyone when a new post or reply is added

Emails are sent from Moodle SMTP settings using http://mandrill.com/ (a mail sending and tracking site for free)

If you reset your password, do another action that makes the site send you an email, the site sends you an email

Problem:

When someone creates a new forum/news post it generally (more than 70% of the time) sends out the email to all subscribers notifying them of the new post, but, if someone replies, no one is notified most of the time (I have done tests before, but would estimate this at less than 10% of the time)

I have done some tests today from a test forum, and it does not send out any emails, even when I manually run the cron script? (over and over again)

Past fix to a similar problem:

After updating from 1.9, no emails went out at all from any forum or news post (but they did from reset password), and I found that the user level (e.g. student, etutor) were not replicated into the forums, so although the forum shows how many subscribers you had, they were not subscribed because they don't have a role within the forums. So I needed to re add all users to the forum and this (sort of) fixed it, but now we are using the site more, we are seeing that not all messages are being sent.

Has anyone got any other ideas on how to resolve this?

 

In reply to Nathan Revill

Re: Forum not sending eMail - Cron is working

by Nathan Revill -

I have found the solution.

In this case, I had increased the server security due to a high number of attacks. Two tweeks I made were to modify SMTP Restrictions and preventing "nobody" from sending mail.

I also found that some of the forums did not have any subscribers, so now everyone is subscribed, and the restrictions modified, its all working well.

You can find if any ports are blocked on your site using the cmd or terminal and use

telnet yourmoodlesite.com 25

Change yourmoodlesite.com for your domain and change port 25 for other ports, e.g. 587 or 465 if your using ssl.

Or, use this site as it will scan your site for you - https://pentest-tools.com/discovery-probing/tcp-port-scanner-online-nmap

Good Luck. big grin

In reply to Nathan Revill

Re: Forum not sending eMail - Cron is working

by Dave Emsley -

hi There,


I have this issue on a server to which I have no access to change SMTP restrictions.

New users get their emails but forum subscribers don't get anything from forums.  Any ideas as to how I could resolve this?


Cheers


Dave

In reply to Nathan Revill

Re: Forum not sending eMail - Cron is working

by Dave Emsley -

Hi Nathan,


Could you expand on the fix with regards to the SMTP restrictions please.


Cheers


Dave

In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by Seth Lewis -

I had a similar issue - emails stopped sending even though no email settings were changed. After a good bit of frustration, I stumbled on an error message in the cron log that said something about the time zone setting. Evidently, setting the time zone to UTC-X (any number) somehow caused the email to fail. Once I changed the timezone setting back to 'server's local time' it immediately started sending the emails again. 

Average of ratings: Useful (1)
In reply to Seth Lewis

Re: Forum not sending eMail - Cron is working

by dan attwood -

I just been battling this issue as well.

To fix this I did

chown administrator:www-data -R mod/forum

Then I opened up the mdl_task_scheduled table and added in a row for the forum

component  - classname 

mod_forum - \mod_forum\task\cron_task





In reply to dan attwood

Re: Forum not sending eMail - Cron is working

by Robin Trangmar -

I'm running the latest Moodle 3.1, and this issue was present with the last release 3.0.4.

Crons are running correctly

All the mailbox settings are checked and have been modified to see if there is a difference

ISP has checked all the server side mailbox settings

I've created the following mailboxes >  inbox.tobeconfirmed@domain  and  tobeconfirmed@domain 

I'm now looking for a wall to bang my head on! Any help would be gratefully received!!

Running Cron again gets this report:

>>

Execute scheduled task: Forum mailings and maintenance jobs (mod_forum\task\cron_task)

... started 09:44:10. Current memory use 11.8MB.

Processing user 4

Processing user 13

Sending Error: lib/moodlelib.php email_to_user(): SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

post 790: Re: Test message

Processing user 1437

Processing user 6

Processing user 19

Sending Error: lib/moodlelib.php email_to_user(): SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

post 790: Re: Test message

Processing user 3

Processing user 2

Processing user 24

Sending Error: lib/moodlelib.php email_to_user(): SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

post 790: Re: Test message

3 users were sent post 790, 'Re: Test message'

Starting digest processing...

Cleaned old digest records

... used 72 dbqueries

... used 1.0838561058044 seconds

Scheduled task complete: Forum mailings and maintenance jobs (mod_forum\task\cron_task)

Execute scheduled task: Incoming email pickup (tool_messageinbound\task\pickup_task)

... started 09:44:11. Current memory use 20.9MB.

Connecting to mail.s702.sureserver.com as moodle.2016@domain

Connection established.

Searching for Unseen, Unflagged email in the folder 'INBOX'

Found 0 messages to parse. Parsing...

... used 0 dbqueries

... used 0.06174898147583 seconds

Scheduled task complete: Incoming email pickup (tool_messageinbound\task\pickup_task)

Execute scheduled task: Removes any unnecessary event monitor events (tool_monitor\task\clean_events)

... started 09:44:11. Current memory use 22.4MB.

In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by David Hordan -

I was suffering the same programming error. Thank you guys.

In reply to David Hordan

Re: Forum not sending eMail - Cron is working

by Ruan Vermeulen -

Good Day guys i have a problem with my Forum emails where it is sending the emails but its not sending it to any users.


This is what my cron output is 

</pre>Execute scheduled task: Forum mailings and maintenance jobs (mod_forum\task\cron_task)
... started 07:32:59. Current memory use 28.3MB.
0 users were sent post 24, 'Re: Test email from moodle'
0 users were sent post 25, 'Re: Test email 2016/04/21'
0 users were sent post 26, 'Re: Test email 2016/04/21'
0 users were sent post 27, 'Re: Test email 2016/04/21'
Starting digest processing...
Cleaned old digest records
... used 37 dbqueries
... used 0.40194010734558 seconds
Scheduled task complete: Forum mailings and maintenance jobs (mod_forum\task\cron_task)
<pre>
Please help I have been struggling with this for weeks
In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by Michael B -

Hi everyone,


I am going to ask here as it is somewhat related. Cron is working and E-Mails are being sent. It does not matter if gmail.com, hotmail.com, web.de or gmx.de are used, they all work. Here comes the strange part... Some users will not get a E-Mail and some do in the same course. In fact, they do not even appear in the E-Mail Log.

Has anyone also had this problem and fixed it?


We are curently using Moodle Moodle 2.9.3+ (Build: 20151204) runing on Debian 7.11. Our current solution would be to do a clean install of Moodle 3.1 and import our users and courses with a backup so we have a clean install however this will not happen in the next couple of days so until we upgrade it would be nice to have a other solution for this problem.

In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by kanchan Paras -

Thanks for all solution here. I tried most of them but none worked for my case. in My case, forum is sending all notification for Forum and News Forum.

BUT for SITE NEWS no email are sending to any user and server error log showing this error repeatedly.


[17-Oct-2016 09:30:00 America/Los_Angeles] Default exception handler: Can not read file, either file does not exist or there are permission problems Debug: [dataroot]/filedir/26/90/269002a05f5ba287d8f75989ad8b54c93a0173f4
Error code: storedfilecannotread
* line 445 of \lib\filestorage\stored_file.php: file_exception thrown
* line 1967 of \lib\filelib.php: call to stored_file->readfile()
* line 2333 of \lib\filelib.php: call to readfile_accel()
* line 4041 of \lib\filelib.php: call to send_stored_file()
* line 37 of \pluginfile.php: call to file_pluginfile()

[17-Oct-2016 09:37:13 America/Los_Angeles] Default exception handler: Can not read file, either file does not exist or there are permission problems Debug: [dataroot]/filedir/26/90/269002a05f5ba287d8f75989ad8b54c93a0173f4
Error code: storedfilecannotread
* line 445 of \lib\filestorage\stored_file.php: file_exception thrown
* line 1967 of \lib\filelib.php: call to stored_file->readfile()
* line 2333 of \lib\filelib.php: call to readfile_accel()
* line 4041 of \lib\filelib.php: call to send_stored_file()
* line 37 of \pluginfile.php: call to file_pluginfile()


any help Please?


In reply to Sandy deFerbrache

Re: Forum not sending eMail - Cron is working

by Darko Kozarski -

Hello to everyone, here is the solution how to resolve this problem!

Problem i caused by unreliable SMTP connection between moodle and mail server,
so only one or few users from the course group receive mail message, all other mails were: Failed to send due to the following error: "SMTP connect()

The solution is to use local mail system at the same server with Moodle installation.

You only have to set relay mail server address in local mail system (exim4, postfix, at Linux servers), and to leave field SMTP host settings at Moodle empty (default).

Best Regards,

Darko Kozarski

Average of ratings: Useful (1)