2

I am trying to familiarize myself with crontab. I know that it is supposed to send an email containing the output of jobs to the user that scheduled them however, I can see in the syslog that the address crontab is sending emails to is not a "local" one (as if I were to type mail -s "email here" username) but an external email address (like user@example.com).

Can someone tell me from where this email is derived and how I can set the users' email address to something else?

This could be because I have a top-level domain associated with my instance (I can see in the log the emails are being sent there), however, I actually have two domain names pointed to this server so I don't know how crontab is choosing or what would happen if there were no domain on this machine.

In short I am just trying to figure out where this default email address is set.

  • On what operating system? The capabilities to send emails to non-local users depends on the cron implementation. And what MTA (mail server software, e.g. postfix, exim, etc.) are you using? It may be the MTA that's doing the rewriting. – Gilles Aug 17 '16 at 21:47
  • This is for Ubuntu Linux. What is strange to me is that, until I installed mailutils, I could not even use the mail program, therefore I do not know how cron would have sent an email (even to local users). – Startec Aug 18 '16 at 5:05
1

man 5 crontab

       If MAILTO is defined (and non-empty), mail  is  sent
       to the user so named.  MAILTO may also be used to direct mail to multi‐
       ple recipients by separating recipient users with a comma.
  • 1
    Good find! Unfortunately this does not explain where mail is sent if MAILTO is not defined and does not answer my question. – Startec Aug 17 '16 at 4:43
  • 1
    user@cat /etc/mailname or how you configured your mta. it's not crontab's job to choose address, it always addresses the local user. – Ipor Sircer Aug 17 '16 at 4:47
  • Ah, there is the answer I am looking for. So it appends the users' name onto how the mta was configured. I see, thank you. – Startec Aug 17 '16 at 4:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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