Example mailx letter
Here is an example of a simple email written using the mailx
command:
Subject: Test Email
From: [email protected] To: [email protected] Date: Mon, 14 Mar 2023 14:30:00 +0000
Dear Recipient,
This is a test email sent using the mailx
command. I hope it reaches you successfully!
Best regards, Your Name
End of Message
To send this email using mailx
, you would use the following command:
mailx -s "Test Email" [email protected] << EOF
From: [email protected]
Date: Mon, 14 Mar 2023 14:30:00 +0000
Dear Recipient,
This is a test email sent using the `mailx` command. I hope it reaches you successfully!
Best regards,
Your Name
EOF
Here's a breakdown of the command:
mailx
: the command to send an email-s "Test Email"
: sets the subject of the email[email protected]
: the email address of the recipient<< EOF
: begins the email body, which is defined by the text that followsFrom: [email protected]
: sets the sender's email addressDate: Mon, 14 Mar 2023 14:30:00 +0000
: sets the date and time of the email- The rest of the text is the email body, which is formatted as a plain text message.
Note that the mailx
command is often aliased to mail
or sendmail
on many systems, so you may need to use one of those commands instead. Additionally, the syntax may vary slightly depending on the specific implementation of mailx
on your system.