Change the “From:” address in Unix “mail”

后端 未结 19 2108
萌比男神i
萌比男神i 2020-12-12 14:32

Sending a message from the Unix command line using mail TO_ADDR results in an email from $USER@$HOSTNAME. Is there a way to change the \"From:\" ad

19条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-12 14:35

    Here are some options:

    • If you have privelige enough, configure sendmail to do rewrites with the generics table

    • Write the entire header yourself (or mail it to yourself, save the entire message with all headers, and re-edit, and send it with rmail from the command line

    • Send directly with sendmail, use the "-f" command line flag and don't include your "From:" line in your message

    These aren't all exactly the same, but I'll leave it to you look into it further.

    On my portable, I have sendmail authenticating as a client to an outgoing mail server and I use generics to make returning mail come to another account. It works like a charm. I aggregate incoming mail with fetchmail.

提交回复
热议问题