Re: Sending email from command line?



echo "Call from customer X" | mail -s "Call from customer X" -f
postfix@xxxxxxxx fred@xxxxxxxx:

ubuntu postfix/smtp[10213]: D24476343E1: to=<fred@xxxxxxxx>,
relay=smtp.isp.tld [some_ip_here]:25, delay=0.37,
delays=0.08/0.04/0.22/0.03, dsn=5.0.0, dUmMy=bounced (host
smtp.isp.tld[some_ip_here] said: 504 <root@acme>: Sender address
rejected: need fully-qualified address (in reply to MAIL FROM
command))

Is it possible to specify the FROM and TO fields from the command
line, and if yes, how?

The "to" address was OK, as the transcript shows. -f doesn't do what you think it does. It's hard to fiddle with the "from" address. If it was easy, it would be even easier to forge. I suspect it is possible to fix the domain name (which is what postfix is complaining about) but I'll leave that for someone who knows postfix to address. Making sure there is a fully qualified name in /etc/hosts might be a good start.
.