How to delete the queue of outgoing (notification) mails

Re: How to delete the queue of outgoing (notification) mails

by Ken Task -
Number of replies: 4
Picture of Particularly helpful Moodlers

Forums could be forced subscribed.

Find all the forums via overview of plugins.   Visit each forum and check settings.

Even changing config ... forums have already sent the mail ... Elvis left the building.

I had this happen about a week or so ago with a newbie Moodle admin ... thankful that I had Postfix in front of any other smarthost (smtp relay) cause I let Moodle do it's thing and manually cleared the mailques as messages came in thus preventing the moodle server from getting blacklisted god knows where.  And didn't mess with config of forums .... 125 of them ... nor the related tables.   Did have a long talk with the newbie Moodle admin though.   Not his fault ... he didn't know that 8000+ users were subscribed to a hidden forum that had never been used by former Moodle Admin.

Not ideal ... a pain in the arse ... but ....

'spirit of sharing', Ken


In reply to Ken Task

Re: How to delete the queue of outgoing (notification) mails

by Lexi K -

Hey Ken. Thanks for sticking with me. Moodle has to keep track of the forum notifications somewhere because if not how would it be able to tell the mail server which mails it would need to send out when the cronjob runs?

I want to find that place and delete the forum notifications so that no one gets spammed with old notifications that are not needed anymore.

That's why I think logs won't cut it -- afaik logs only document what has happened, they do not store what is supposed to happen later, right?

Modifying the forum configs for subscriptions may cut it. That's a good idea. However I would need to find out if it really will work.

I can be sure that no mails were already created by the mail server because the cronjob for Moodle to tell the mail server to create mails has not been run for a long time/ever.

"sorry, but once moodle packages up whatever it's supposed to send, a cron job/task will attempt to send as many and as soon as it can - that's handed over to the mail server and it's que."

Yeah, I know the cronjob has not been run so how do I find that package that Moodle has packaged up of what it's supposed to send? I want to delete exactly that or change it so nothing will get send. Probably Moodle checks in the database whether a forum post has been sent to the subscribed users. So I would need to find that information and overwrite it manually to "yes the mails have already been sent" or "there are no subscribers."

I am looking at the database with mysql terminal tool and try to find where Moodle keeps track of what notifications need to be send when the cronjob gets run. Is there an official documentation about what table does what and what column is for what purpose?

I have more ideas how to solve the problem now so thank you again Ken!

In reply to Lexi K

Re: How to delete the queue of outgoing (notification) mails

by Ken Task -
Picture of Particularly helpful Moodlers

There's human 'logic' (maybe that's you and I) ... then there's 'computer logic' ... then there's 'program logic' ... etc.  Are they all the same? ... ie, do they all 'think alike'?   Not really a  question for response ... just a thought.

Anyhoo ... one of the 8 tables

mdl_forum
mdl_forum_digests
mdl_forum_discussions
mdl_forum_posts
mdl_forum_queue
mdl_forum_read
mdl_forum_subscriptions
mdl_forum_track_prefs

See what's in them on your system.   None of the 'clients' I help use forums.

In mdl_forum_posts.  There's a 'mailed' column and a 'mailnow' column ... if user opts to 'mailnow' in things like forums, etc., Elvis tries the leave the building right away - which, I think, would mean data is packaged up and control handed off to mail systems.

There is no task/part of cron job that attempts cancelling or clearing a mailque ... locally or on an SMTP server somewhere.   Deleting the row??? Might confuse other related tables but, hopefully, moodle would recover and one would not be stuck with looking at an error every day.

And depending upon the number of persons to get the message, that could be really quickly accomplished, or, in the case of 8000 users forced subscribed that could tax a server, do all sorts of different things related to mail systems.

Then there are user preferences for handling mail or messages.

Could have simply said ... dunno ... but, did dunno with an explanation ... maybe it will lead you somewhere.

Maybe if we made a plea to the real Moodle Guru's one would jump in here and clear the confusion. smile

*Calling ALL Moodle Guru's!!!  Got a minute?  HELP Lexi K out!*

'spirit of sharing', Ken


In reply to Ken Task

Re: How to delete the queue of outgoing (notification) mails

by Lexi K -

Hey Ken, I just risked it and turned off notification subscriptions. There were only two relevant forums anyway. It seems to have worked, although I can't tell for sure yet. Will post again if I know more so people with the same problem in the future know whether turning off notification subscriptions is a possible solution. Thanks again

In reply to Lexi K

Re: How to delete the queue of outgoing (notification) mails

by Ken Task -
Picture of Particularly helpful Moodlers

Is your cron now running ok?   That's a must with Moodle these days!

'spirit of sharing', Ken