How can i send an email through UNIX mailx command

2019-01-16 03:02发布

How can i send an email through UNIX mailx command

标签: unix email mailx
10条回答
看我几分像从前
2楼-- · 2019-01-16 03:45

Its faster with MUTT command

echo "Body Of the Email"  | mutt -a "File_Attachment.csv" -s "Daily Report for $(date)"  -c cc_mail@g.com to_mail@g.com -y
  1. -c email cc list
  2. -s subject list
  3. -y to send the mail
查看更多
Viruses.
3楼-- · 2019-01-16 03:50

Here you are :

echo "Body" | mailx -r "FROM_EMAIL" -s "SUBJECT" "To_EMAIL"

PS. Body and subject should be kept within double quotes. Remove quotes from FROM_EMAIL and To_EMAIL while substituting email addresses.

查看更多
男人必须洒脱
4楼-- · 2019-01-16 03:50
mailx -s "subjec_of_mail" abc@domail.com < file_name

through mailx utility we can send a file from unix to mail server. here in above code we can see first parameter is -s "subject of mail" the second parameter is mail ID and the last parameter is name of file which we want to attach

查看更多
仙女界的扛把子
5楼-- · 2019-01-16 03:51

Customizing FROM address

MESSAGE="SOME MESSAGE"
SUBJECT="SOME SUBJECT"
TOADDR="u@u.com"
FROM="DONOTREPLY"

echo $MESSAGE | mail  -s "$SUBJECT" $TOADDR  -- -f $FROM
查看更多
登录 后发表回答