Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the beginning of a crontab file you can use the MAILTO instruction to indicate you want the output to be sent as an e-mail to an e-mail address. I would like to send the output to multiple addresses. Is it possible (and how) to specify multiple addresses?

Thanks! Boaz

share|improve this question
up vote 33 down vote accepted

It may differ depending exactly which cron daemon package you use, but this is from the manpage of Vixie Cron on Ubuntu Hardy:

If MAILTO is defined (and non-empty), mail is sent to the user so named. MAILTO may also be used to direct mail to multiple recipients by separating recipient users with a comma. If MAILTO is defined but empty (MAILTO=""), no mail will be sent. Otherwise mail is sent to the owner of the crontab.

If you're not using Vixie Cron, or aren't sure, try the manual page for the crontab file: man 5 crontab

share|improve this answer
One thing to note -- use just a comma between addresses. Do not use a space as well, otherwise cron will log the address (probably in /var/log/cron or /var/log/daemon) as "UNSAFE" and will refuse to send to that list of addresses. – David Gardner Sep 6 '13 at 8:23
When separating addresses with spaces instead of commas, it happened to me that cron sent mails to the first address only (and crontab had not complained when saving changes, which is a shame). There are errors in the syslog ((CRON) error (bad mailto)), but nobody noticed ... – Tobias Sep 11 '13 at 8:52

As an alternative to above answers, you can send it to a single address which is a mail group. This works especially well if you manage multiple servers since it is easier to manage addresses in the group on a mail server then in crontab of each individual server.

share|improve this answer
IMHO this is the right answer. Who wants to maintain individual lists of email addresses in various crontabs? – Satanicpuppy Feb 3 '14 at 16:49

Except capturing the output in the program being run by crond and emailing it directly from there, it's not really possible (at least to my knowledge. Forthcoming comments may prove otherwise!)

A good workaround might be a .forward file on that user account which sends mail to the appropriate addresses.

share|improve this answer
+1 .forward file is the way to go. – sleske Apr 16 '10 at 11:17

Well, it is simple really, but I am not sure whether it depends on your MTA. But I've had to do this a few times, and you simply add ; after each email address.

For example

share|improve this answer
In the documentation, the e-mails are separated by a comma, you are using a semicolon here. Are you sure this syntax is working? – physicalattraction Dec 28 '15 at 13:51

The best answer is probably to either check your man pages for your distro's current version of cron/crontab to see if there's something that can be done with the MAILTO parameter or specify a mail address that in turn forwards mail to multiple addresses for you.

share|improve this answer

From man pages of crontab : "MAILTO may also be used to direct mail to multiple recipients by separating recipient users with a comma"

share|improve this answer
Since this is already stated verbatim in the accepted answer, I'm not sure how this answer is adding any value. – ThatGraemeGuy Feb 21 '12 at 12:29

protected by MadHatter Feb 3 '14 at 17:03

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.