How to set the From email address for mailx command?

前端 未结 8 770
鱼传尺愫
鱼传尺愫 2020-12-24 05:28

I am working on a KornShell (ksh) script running on a Solaris server that will send out an email when and error condition is met. I am sending the email via mailx

8条回答
  •  误落风尘
    2020-12-24 06:11

    In case you also want to include your real name in the from-field, you can use the following format

    mailx -r "me@example.com (My Name)" -s "My Subject" ...
    

    If you happen to have non-ASCII characters in you name, like My AEÆoeøaaå (Æ= C3 86, ø= C3 B8, å= C3 A5), you have to encode them like this:

    mailx -r "me@example.com (My =?utf-8?Q?AE=C3=86oe=C3=B8aa=C3=A5?=)" -s "My Subject" ...
    

    Hope this can save someone an hour of hard work/research!

提交回复
热议问题