Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

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
add comment

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.

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
add comment

Your Answer

 
discard

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.