Use Curl to read your imap emails

You can use the bash command “curl” to read your imap emails like this:

curl --url "imaps://" --user "username:password"

Note: your password will be visible on the command line, so don’t use this on a public server.

So it is actually better to create a file, for instance called secret, then write your password in it, and protect it with:

chmod 400 secret

Then you can use this command instead:

curl --url 'imaps://' --user 'username:<code>cat secret</code>'

If there is a SSL certificate issue, you can also try (not recommended of course):

curl --insecure --url "imaps://" --user "username:password"

You need a newer version of curl, because version before 7.29 have limited imap support.

In order to upgrade curl on a Centos system, you can:

Create a new file /etc/yum.repos.d/city-fan.repo

Then paste the following contents:

name=City Fan Repo


yum update curl

You can very finally the version of curl:

curl --version

See also:

Sending an email with a different From: address

Sometimes you have to send an email with a different “From:” address. This can be easily done in LINUX. Please see the video below, and read the text below the video for further explanations. If you have questions, please, just add your comment, I will be happy to answer 🙂

Was the video helpful? Here are some explanations of the commands that I used:


export EMAIL="Title Firstname Lastname <>"

sets the environment variable EMAIL to what you specify between the two “”. Note, the syntax has to be correct, remember the two <>

The command:

echo -e "some text" | mutt -s "subject text" somename@somewhere


Send the text “some text” through a pipe (the character “|”)  to the program “mutt”, which will send the email to somename@somewhere with the subject “subject text” and the body-text “some text”

If you need to send to multiple people, this is achieved by making the list of email addresses separated with a comma. For example:

echo -e "my message to you" | mutt -s "my subject text",

NB: The Linux command above is written on one-line. No Enter or Returns on keyboard should be done.

Now you can send your emails with any From: address you like.

Remember: it is still your account that sends the email, so changing the From: address doesn’t hide your real identity in the email system.