Social Engineeringsmtpemailcommand-lineperlphishing

sendemail

SendEmail is a lightweight, command line SMTP email client designed for use in scripts and programs. It requires no special modules and offers a straightforward interface for sending emails.

Description

SendEmail is a Perl-based SMTP email agent that operates entirely from the command line. It is optimized for integration into bash scripts, Perl programs, and web sites, making it ideal for automated email delivery tasks. Its simplicity and lack of dependency on special modules make it highly portable and easy to deploy in various environments.

The tool supports essential email features like attachments, CC/BCC recipients, and SMTP authentication. It is particularly useful in cybersecurity contexts, such as phishing simulations, as highlighted in Kali Linux training materials like PEN-300 for creating custom calendar invites.

SendEmail provides verbose logging, quiet modes, and advanced options for message formatting and networking, allowing fine-tuned control over email transmission.

How It Works

SendEmail connects to an SMTP server (default localhost:25) to relay emails using standard SMTP protocols. It supports authentication via username/password, TLS options through advanced flags, and can bind to specific local addresses. Messages are constructed from provided body text, STDIN, or files, with support for MIME attachments and content types like text or HTML. It can also use local sendmail instead of direct network MTA.

Installation

bash
sudo apt install sendemail

Flags

-f ADDRESSfrom (sender) email address (required)
-t ADDRESS [ADDR ...]to email address(es) (required, at least one via -t, -cc, or -bcc)
-u SUBJECTmessage subject
-m MESSAGEmessage body (required, via -m, STDIN, or -o message-file=FILE)
-s SERVER[:PORT]smtp mail relay, default is localhost:25
-S [SENDMAIL_PATH]use local sendmail utility (default: /usr/bin/sendmail) instead of network MTA
-a FILE [FILE ...]file attachment(s)
-cc ADDRESS [ADDR ...]cc email address(es)
-bcc ADDRESS [ADDR ...]bcc email address(es)
-xu USERNAMEusername for SMTP authentication
-xp PASSWORDpassword for SMTP authentication
-b BINDADDR[:PORT]local host bind address
-l LOGFILElog to the specified file
-vverbosity, use multiple times for greater effect
-qbe quiet (i.e. no STDOUT output)
-o NAME=VALUEadvanced options, e.g. -o message-content-type=<auto|text|html>, -o message-file=FILE, -o message-format=raw
--helpthe helpful overview
--help addressingexplain addressing and related options
--help messageexplain message body input and related options
--help networkingexplain -s, -b, etc
--help outputexplain logging and other output options
--help miscexplain -o options, TLS, SMTP auth, and more

Examples

Display the help overview for sendEmail
sendemail -h
Send a basic email with from, to, subject, and body
sendemail -f sender@example.com -t recipient@example.com -u "Subject" -m "Message body"
Send email with CC and BCC recipients
sendemail -f sender@example.com -t recipient@example.com -cc cc@example.com -bcc bcc@example.com -u "Subject" -m "Message"
Send email via custom SMTP server and port
sendemail -f sender@example.com -t recipient@example.com -u "Subject" -m "Message" -s smtp.example.com:587
Send email with file attachment
sendemail -f sender@example.com -t recipient@example.com -u "Subject" -m "Message" -a attachment.txt
Send email with SMTP authentication
sendemail -f sender@example.com -t recipient@example.com -u "Subject" -m "Message" -xu username -xp password
Send email with verbosity and custom logging
sendemail -f sender@example.com -t recipient@example.com -u "Subject" -m "Message" -v -l /path/to/logfile
Updated 2026-04-16kali.org ↗