Linux send test email

A classic!

To send a test email from a Linux terminal, you can use the mail command or a more advanced tool like sendmail or ssmtp.

Method 1: Using the mail command

  1. Open a terminal and type: mail -s "Test Email" [email protected]
  2. Replace [email protected] with the email address you want to send the test email to.
  3. You will be prompted to enter the email body. Type your message and press Enter.
  4. Press Enter again to send the email.

Method 2: Using sendmail

  1. Install sendmail if it's not already installed: sudo apt-get install sendmail (on Ubuntu-based systems) or sudo yum install sendmail (on RHEL-based systems).
  2. Open a terminal and type: sendmail -v -f [email protected] -t
  3. Replace [email protected] with the email address you want to send the test email to.
  4. You will be prompted to enter the email body. Type your message and press Enter.
  5. Press Enter again to send the email.

Method 3: Using ssmtp

  1. Install ssmtp if it's not already installed: sudo apt-get install ssmtp (on Ubuntu-based systems) or sudo yum install ssmtp (on RHEL-based systems).
  2. Configure ssmtp by editing the /etc/ssmtp/ssmtp.conf file (on Ubuntu-based systems) or /etc/ssmtp/ssmtp.conf (on RHEL-based systems). Set the mailhub option to your email provider's SMTP server.
  3. Open a terminal and type: ssmtp -v [email protected]
  4. Replace [email protected] with the email address you want to send the test email to.
  5. You will be prompted to enter the email body. Type your message and press Enter.
  6. Press Enter again to send the email.

Remember to replace [email protected] with your actual email address and email provider's SMTP server settings.