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

I have a server with Gentoo and Postfix. Postfix is configured so that all e-mail messages are routed through an external relay which requires a particular address in 'From'.

From /etc/postfix/

relayhost =

I also have a cron task, which I'd like to send e-mail from. But the 'From' address is 'user@hostname', which is not allowed on a relay. Is it possible to substitute the correct address to cron for sending messages or fix the Postfix configuration in some way?

share|improve this question
What is the command that you are using to send the emails? – Khaled Nov 15 '10 at 9:33
There is no command, just MAILTO='' in a crontab file... – artvolk Nov 16 '10 at 10:28
up vote 1 down vote accepted

I use vixie-cron and ssmtp for a similar situation. What I do, especially for root jobs, is pipe the output of the command through | mail -r ""; it's tedious but it works.

share|improve this answer
Yes, I also have vixie-cron. Unfortunatelly this is a custom built VDS even without 'mail' command. Finally I wrap the call to my task in php which captures output and emails it. You solution should work too, so I mark it as an answer. – artvolk Nov 16 '10 at 10:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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