is there any way to salvage lost outgoing e-mails?

is there any way to salvage lost outgoing e-mails?

by stefan weber -
Number of replies: 9
Picture of Plugin developers

due to a configuration change on our e-mail server, some mails were not sent since moodle could not connect to the server.

since then we fixed the configuration, but I cant find any way to re-send mails that were not sent, or even find out how many / which mails were not sent.

the server uses an smtp relay to our actual mailserver, so in moodle, localhost is set as mailserver for outgoing mails

is there any chance to salvage the lost e-mails, or re-send them?

Average of ratings: -
In reply to stefan weber

Re: is there any way to salvage lost outgoing e-mails?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
You mean Moodle delivers mail to localhost which relays mail to the actual mail server? And the problem was in the actual mail server?

Then I guess Moodle and the localhost have done their job. You can confirm by going through the mail logs of the localhost. Or, the mails are still spooled in localhost. Tell it to resend. (Typically "# sendmail -q")
In reply to Visvanath Ratnaweera

Re: is there any way to salvage lost outgoing e-mails?

by stefan weber -
Picture of Plugin developers

I got this info from our mail server admins:

The question is not, how we could resend from our mail-server, the
question is, how moodle can resend.
Our setup are one moodle-server (on alice), a mail-server (on alice,
too), a mail-server (on ben).  moodle -> localhost -> ben.
The mail-server on alice did not get any mail, because it was not
reachable.
How we can resend the mail, moodle failed to send?  «moodle-mail -q»?

If not, how we can configure moodle to use sendmail instead of smtp, to
prevent lost mails in future?

For your information, if not possible:  smtp never does promise to
accept a mail.  Also if server is running on localhost.  A restart of
the mail-server would be enough to lost mails.  So it is a stupid idea
to use smtp for sending mails, if moodle has no possible way to resend
mails.  It has to have a Queue.  If you say "mail-server should run on
localhost to prevent most issues", than you should not support smtp and
use sendmail.  (But we did not found an option in moodle to do that and
google sais no.)



In reply to stefan weber

Re: is there any way to salvage lost outgoing e-mails?

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
there is no easy way to get Moodle to resend all emails that have previously failed.

But if you remove the smtphosts config setting in admin > Server >Email > Outgoing mail configuration (and leave it blank)

then as per the description under that setting "If you leave this field blank, Moodle will use the PHP default method of sending mail." - which will likely pass it to sendmail on your local server. (as long as PHP is configured this way - it should be, it's the default method.)

In reply to Dan Marsden

Re: is there any way to salvage lost outgoing e-mails?

by stefan weber -
Picture of Plugin developers

thanks, that will help us to avoid such problems in the future smile

In reply to stefan weber

Re: is there any way to salvage lost outgoing e-mails?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Stefan

Your admins said:
> The question is not, how we could resend from our mail-server, the question is, how moodle can resend.

As Dan have confirmed, you can not ask Moodle to _resend_ its mails (if it has already sent that is).

> Our setup are one moodle-server (on alice), a mail-server (on alice, too), a mail-server (on ben). moodle -> localhost -> ben.

That is a common setup. We call it Moodle -> localhost (mail relay) -> actual SMTP server.

> The mail-server on alice did not get any mail, because it was not reachable.

Could you ask them to recheck this statement? 'alice' is the localhost of Moodle. It is odd that the localhost was not reachable. (Well, not impossible, e.g. if the SMTP has died.)

> How we can resend the mail, moodle failed to send? «moodle-mail -q»?

As already said, there is no such thing.

If the statement above, that SMTP daemon on localhost was not really available, is correct, then Moodle must received SMTP errors. Unless you've had some debugging activated, you can't be sure. You can simulate it though: kill the SMTP daemon on the localhost, raise the debugging level and try messaging somebody through Moodle.

If it was ben, the real SMTP server, which was out, depending on the duration of the breakdown, alice (the mail-relay) may still have the mails in its spool. You need somebody who knows the intricacies of the mail server programs used. (Mail relay is also a kind of mail server, just limited in function.)

> If not, how we can configure moodle to use sendmail instead of smtp, to prevent lost mails in future?

I will stay with the original subject, ways to salvage lost mails.

> For your information, if not possible: smtp never does promise to accept a mail. Also if server is running on localhost.

Your mail admins are confused. "smtp never does promise to accept a mail" is total nonsense. If SMTP quit a mail with ok, it means it has accepted the mail. It does not promise to _deliver_ it, though.

> A restart of the mail-server would be enough to lost mails.

That could be true. See "depending on the duration of the breakdown, alice may have the mails still in its mail spool" above.

> So it is a stupid idea to use smtp for sending mails, if moodle has no possible way to resend mails. It has to have a Queue. If you say "mail-server should run on localhost to prevent most issues", than you should not support smtp and use sendmail. (But we did not found an option in moodle to do that and google sais no.)

Your mail admins are pragmatists who haven't studied the networking part of it, but just shout instead. Stupit idea!
smile

For your reference: 'sendmail' is a _program_ whereas SMTP is a _protocol_. It so happens that sendmail masters SMTP, but not the only one. They are neither synonymous nor competitors.
In reply to Visvanath Ratnaweera

Re: is there any way to salvage lost outgoing e-mails?

by stefan weber -
Picture of Plugin developers

thanks a lot for the exhaustive replay, i gave up upon those mails by now, but its good to have some things clarified smile


In reply to stefan weber

Re: is there any way to salvage lost outgoing e-mails?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Of course it was not exhaustive by a long shot! How could it be, if you don't answer a simple question like "Could you ask them to recheck this statement?" (See my prev. post.)

And then the number of tangents your mail admins took. Here is another example: "So it is a stupid idea to use smtp for sending mails, if moodle has no possible way to resend mails. It has to have a Queue."

They seem to know that Moodle has no built in mail server (rightly so), but then expect it to have a queue. The queue is in the mail server!

Or, to put it another way, they couldn't repair their broken mail server soon enough so that the mail is still in the spool. Instead they call the other party "stupid". Ask them to do their home work, before calling others stupid.
sad

Edit: I noticed that we both are in the German language zone. So the issue could be partly a language issue. Whatever, I wanted to put the record straight. No hard feelings, I hope.
In reply to stefan weber

Re: is there any way to salvage lost outgoing e-mails?

by Dave Balch -

For anyone wondering about how to use smtp but avoid silently losing emails like this, MDL-53023 aims to "Add email message deliver-ability and engagment tracking and reporting" - which, if implemented, would help flag this sort of problem in future. Seems to have stalled though sad


In reply to Dave Balch

Re: is there any way to salvage lost outgoing e-mails?

by stefan weber -
Picture of Plugin developers
sounds like a good improvment to me smile