-
Send a blank test message with a subject to an email address:
mail -s "Subject" [email protected] < /dev/null
(you can substitute /dev/null with a file, or pipe, to populate the body. It must end with a period on a line by itself.)
-
Send a blank email with an attachment:
mail -a somefile -s "Subject" [email protected] < /dev/null
-
Use
netcat
ortelnet
mjl@tesla> nc localhost 25
220 tesla.local ESMTP Postfix
HELO gmail.com
250 tesla.local
MAIL FROM: [email protected]
250 2.1.0 Ok
RCPT TO: [email protected]
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
Subject: test message
hello from tesla
.
250 2.0.0 Ok: queued as 7D91946
QUIT
221 2.0.0 Bye
mjl@tesla>
The SMTP commands may be lower-case, I spelled them in uppercase here for clarity. There is no SMTP command for Subject, use the DATA command and add whatever headers you want, separate from the body with a blank line.