Smtp mail to command

You're looking for a command to send an email using SMTP (Simple Mail Transfer Protocol).

Here are a few options:

1. Using the mail command ( Unix/Linux ):

mail -s "Subject" [email protected] << EOF
Body of the email
EOF

Replace [email protected] with the email address of the recipient, and Subject with the subject of the email. The << EOF syntax allows you to enter the email body.

2. Using the sendmail command ( Unix/Linux ):

sendmail -v [email protected] << EOF
Subject: Subject
Body of the email
EOF

This command is similar to the mail command, but it's more powerful and flexible.

3. Using the msmtp command ( Unix/Linux ):

msmtp -a account -s "Subject" [email protected] << EOF
Body of the email
EOF

Replace account with the name of your email account, and [email protected] with the email address of the recipient.

4. Using the telnet command ( Unix/Linux ):

telnet smtp.example.com 25

Replace smtp.example.com with the hostname or IP address of your SMTP server. Once connected, you can enter the email message using the SMTP commands (e.g., HELO, MAIL FROM, RCPT TO, DATA, etc.).

5. Using a scripting language (e.g., Python, Ruby, PHP): You can use a scripting language to send an email using SMTP. For example, in Python:

import smtplib
from email.mime.text import MIMEText

msg = MIMEText('Body of the email')
msg['Subject'] = 'Subject'
msg['From'] = '[email protected]'
msg['To'] = '[email protected]'

server = smtplib.SMTP('smtp.example.com')
server.sendmail('[email protected]', '[email protected]', msg.as_string())
server.quit()

Replace smtp.example.com with the hostname or IP address of your SMTP server, and [email protected] with your email address.

Remember to replace the placeholders with your actual email account information and the recipient's email address.