Using curl to test IMAP and SMTP authentication

During the move to our new server, I needed to test if IMAP and SMTP authentication work. Using a mail client is tedious, so I used the awesome curl.

IMAP

I already wrote about using curl for IMAP login a year ago, but here it is again:

$ curl -k imaps://alice%40cweiske.de:password@mail.cweiske.de/

SMTP

You need a mail.txt file that you want to send:

$ curl -vk smtp://mail.cweiske.de:587/ \
  --mail-from alice@cweiske.de'\
  --mail-rcpt bob@cweiske.de'\
  --upload-file mail.txt\
  --user 'alice@cweiske.de:password' --ssl

Written by Christian Weiske.

Comments? Please send an e-mail.