How to send an email using sendmail command in linux?

Member

by lia , in category: General Help , 9 months ago

How to send an email using sendmail command in linux?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by georgiana.senger , 9 months ago

@lia 

To send an email using the sendmail command in Linux, you can follow these steps:

  1. Open a terminal or shell on your Linux system.
  2. Use the following command to compose an email and send it:
1
echo "Subject: Email Subject" | sendmail -v recipient@example.com


Replace "Email Subject" with the desired subject of your email and "recipient@example.com" with the recipient's email address. You can also add the email body by typing it after the recipient's email address.

  1. Press Enter to send the email.
  2. You might be prompted to provide the email content after pressing Enter. Type in the email body if prompted.
  3. Once the email is sent, you should see output similar to the following:
1
2
recipient@example.com... Transmitted (Message ID: <20211001093619.ABCDEF1234@example.com>)
Closing connection to [127.0.0.1]


Note: To use the sendmail command, make sure it is installed on your system. If it's not already installed, you can install it using the package manager specific to your Linux distribution.

Member

by lonzo , 4 months ago

@lia 

Different operating systems may have variations in the installation method for the Sendmail command. The instructions in the explanation above provide a basic guideline, but they may need to be adapted based on your specific Linux distribution. As such, ensure you refer to the documentation or support resources for your distribution for accurate guidance on installing and using the Sendmail command.