简体   繁体   中英

How to change the sender while sending an email using bash

This is what I am using

/bin/mailx -s "$SUBJECT1" "$EMAIL" < "$EMAILMESSAGE"

Since I dont have access to a particular machine I am using my friends credential to login and I want my name as the sender. how should i do it?

使用-r指定“发件人地址”

/bin/mailx -r <replyemail> -s "$SUBJECT1" "$EMAIL" < "$EMAILMESSAGE"

Use email client like mutt to login on your email account. Or are you talking about internal emails on this machine only?

you can try this

export REPLYTO=me@myemail.com
/bin/mailx -aFrom:me@myemail.com "$SUBJECT1" "$EMAIL" < "$EMAILMESSAGE"

to add the from header to the message if your copy of mailx has -a

or

/bin/mailx -s "$SUBJECT" "$EMAIL" -- -f me@myemail.com <  "$EMAILMESSAGE" 

the -- should just pass the -f along to the underlying mail program.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM