1

I am trying to automate my email by using this command on unix VI:

echo 'Message body goes here' | mail -s 'subject line goes here' email@provider.com

However, I would like to add a "CC" and use a different email address showing when I send the email to the recipient.

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
user127192
  • 25
  • 4

1 Answers1

0

mailx is usually link with mail.

Try passing the options to sendmail by putting double-dash at the end and then specifying -f (from) or -r (return):

mailx ....    -- -r returnname@domain.com

mailx ....    -- -f returnname@domain.com

You could also try "-a" option as mentioned here

mailx -a 'From:name@your-domain.com'  ...

If you want to try the sendmail:

sendmail -t <<EOF
To: toname@domain.com
Subject: Hi
From: fromname@domain.com
Reply-To: replyname@domain.com
Hello
EOF
Community
  • 1
  • 1
blackpen
  • 2,339
  • 13
  • 15