I am trying to send a test email from command line (for debugging purpose).

I cannot make the sendmail to send the email. The Ctrl+d does not work on my ssh console and I could not find a solution by search.


  • This doesn't directly answer your question, but from my own experience, I'd recommend ssmtp over sendmail, as you'll find it's more efficient to use, especially if intending to use this in a script (ssmtp uses sendmail) – JW0914 Dec 13 '19 at 14:17

You have used the -t and -i options on the sendmail(8) command line. If you drop the -i option, the email body will be terminated with the ..

For example:

sendmail -t root@example.com
From: me@example.com
Subject: Test
Test email

Alternatively, put the message into a separate file.

For example:

sendmail -t -i root@example.com < test.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.