我得到-aFrom:sender@example.com包含无效字符':'
reciver1@example.com main recipient
reciver2@example.com should be in cc
sender@example.com should be sender
echo "This is the message body" | mail -s "This is the subject" -c reciver1@example.com reciver2@example.com -aFrom:sender@example.com
mailx可以这样为您工作:
value="someValue"
mailx -s "This is the subject" -t <<EOF
To: receiver1@example.com
From: sender@example.com
Cc: receiver2@example.com
Bcc: receiver3@example.com
X-Extra-Flag: ${value}
This is the message.
EOF