Heath SchweitzerHeath Schweitzer
← All posts

Linux command line to test mail() function

February 11, 2014|Heath Schweitzer|1 min read|21 views|Last Updated May 28, 2026

Linux

Linux command to test mail() function:

echo "test email body." | mail -s "test email subject" [email protected]

Instructions:

  1. replace "test email body" with the body copy of your test email
  2. replace "test email subject" with the subject line for your test email
  3. replace [email protected] with the email address to send the test to
  4. optionally includ -c to CC another email address
  5. optionally include -b to BCC another email address
  6. For a longer email body message start with mail(), return, and Control+D as the escape sequence when finished

Tagged

mail()linux command linetest sendmail

If this post was useful, consider buying me a coffee ☕ with ₿itcoin — no account needed, any amount welcome.

Bitcoin tip QR code
⚡ Open in Wallet