Search code examples
linuxemailunixsendmail

How send email with name with third party domain?


Is it possible to send email with address name with third party domain?

For example to send email with address name: [email protected] using Linux environment?


Solution

  • mailx utility can do this. Below is the example:

    Suppose CONTENT is a variable storing the content.

    echo $CONTENT | mailx -r FROM_EMAIL_ID -s "SUBJECT" TO_EMAIL_ID 
    

    Else, you want to pass a file having mail body named CONTENT.txt,

    mailx -r FROM_EMAIL_ID -s "SUBJECT" TO_EMAIL_ID < CONTENT.txt