To start the interactive mode of the
mail -s "Subject" email@example.com
This will open the mail prompt and allow users to compose the email. Once the message is complete, press
Ctrl+D to send the email.
In non-interactive mode, users can send emails using a pre-written message and subject. The basic syntax for sending an email in non-interactive mode is as follows:
echo "Message" | mail -s "Subject" firstname.lastname@example.org
This will send an email with the specified message and subject to the recipient’s email address.
|-s||Specifies the subject of the email|
|-a||Attaches a file to the email|
|-c||Sends a copy of the email to the specified recipient(s)|
|-b||Sends a blind copy of the email to the specified recipient(s)|
|-r||Specifies the sender’s email address|
|-q||Quits the mail prompt without sending the email|
- If the
postfixservice is running on the system.
- If the email is not being delivered, check the spam or junk folder of the recipient’s email account.
- If the email is being rejected by the recipient’s email server, check if the sender’s email address is on a blacklist.