Windows send mail from command line

You can send an email from the Windows command line using the sendmail command or the mail command. Here are the steps:

Method 1: Using the sendmail command

  1. Open the Command Prompt as an administrator.
  2. Type the following command and press Enter:
    sendmail -v -f <from_email> -t -i <subject> <message>

    Replace:

Example:

sendmail -v -f [email protected] -t -i "Test email" "This is a test email."

Method 2: Using the mail command

  1. Open the Command Prompt as an administrator.
  2. Type the following command and press Enter:
    mail -s <subject> <to_email> <message>

    Replace:

Example:

mail -s "Test email" [email protected] "This is a test email."

Additional options

You can add additional options to customize the email. Here are a few examples:

Note: The sendmail command is not available on all Windows systems, and the mail command may not work if you don't have a mail client installed.