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
- Open the Command Prompt as an administrator.
- Type the following command and press Enter:
sendmail -v -f <from_email> -t -i <subject> <message>
Replace:
<from_email>
with the email address you want to send the email from.<subject>
with the subject of the email.<message>
with the body of the email.
Example:
sendmail -v -f [email protected] -t -i "Test email" "This is a test email."
Method 2: Using the mail
command
- Open the Command Prompt as an administrator.
- Type the following command and press Enter:
mail -s <subject> <to_email> <message>
Replace:
<subject>
with the subject of the email.<to_email>
with the email address you want to send the email to.<message>
with the body of the email.
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:
-f
or--from
: Specify the sender's email address.-t
or--text
: Send the email as plain text.-i
or--interactive
: Enable interactive mode, which allows you to enter the email body and subject.-v
or--verbose
: Enable verbose mode, which displays more information about the email sending process.
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.