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/main.cf:

relayhost = relay.example.com

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?

link|improve this question

57% accept rate
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
feedback

1 Answer

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 "required_user@external-domain.com" target_user@wherever.com; it's tedious but it works.

link|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
feedback

Your Answer

 
or
required, but never shown

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