Skip to main content

Send email from the command line.

# To send a message with the content of message.txt to the mail folder of local user 'user_name':
sendmail user_name < message.txt

# To send an email from you@yourdomain.com (assuming the mail server is configured for this) to test@gmail.com containing the message in 'message.txt':
sendmail -f you@yourdomain.com test@gmail.com < message.txt

# To send an email from you@yourdomain.com (assuming the mail server is configured for this) to test@gmail.com containing the file 'file.zip':
sendmail -f you@yourdomain.com test@gmail.com < file.zip