how to send mail linux?

There are several ways to send an email from a Linux system. One common method is to use the sendmail command-line utility.

Here’s an example of how to send an email using sendmail:

  1. Open the terminal and create a new file with a text editor (e.g. nano):
    nano email.txt

    In the text file, enter the following information, replacing the placeholder values with your own:

    To: [email protected]
    Subject: Test Email
    From: [email protected]
    
    This is a test email sent from a Linux system.
    1. Save the file and exit the text editor.
    2. Use the sendmail command to send the email, replacing the recipient email address with the actual email address you want to send the email to:
      sendmail [email protected] < email.txt

      This will send an email to the recipient with the subject “Test Email” and the content “This is a test email sent from a Linux system.”

      Note: sendmail requires a working mail server to be configured on the system. If you do not have access to a mail server, you can use a third-party email service (such as Gmail or Microsoft Outlook) to send emails.

Leave a Comment