Send mail with Exim from the CLI

I needed to test whether mail relaying worked with Exim or not. To do so I used this command:

exim -v recipient@example.com

After this type in your mail contents as shown below and hit CTRL+D afterwards to send it:

From:sender@example.com
Subject: Hello From the CLI
This is a test from the CLI

It’s also possible to use a one-liner:

echo -e "From:sender@example.com\nSubject: Hello From the CLI\nThis is a test from the CLI" | exim -v recipient@example.com

You’ll see the raw output appear on screen, and should see a 250 status code near the end if all went well.

Did this help you out? Like what you see?
Thank me with a coffee.

I don\'t do this for profit but a small one-time donation would surely put a smile on my face. Thanks!

BuymeaCoffee (€3)

To stay in the loop you can follow @bramus or follow @bramusblog on Twitter.

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Unless noted otherwise, the contents of this post are licensed under the Creative Commons Attribution 4.0 License and code samples are licensed under the MIT License

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.