You can use the bash command “curl” to read your imap emails like this:
curl --url "imaps://imapserver.somewhere.net" --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://imapserver.somewhere.net' --user 'username:`cat secret`'
If there is a SSL certificate issue, you can also try (not recommended of course):
[code lang=”bash”]curl –insecure –url "imaps://imapserver.somewhere.net" –user "username:password"[/code]
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:
[CityFan] name=City Fan Repo baseurl=http://www.city-fan.org/ftp/contrib/yum-repo/rhel$releasever/$basearch/ enabled=1 gpgcheck=0
Finally
yum update curl
You can very finally the version of curl:
curl --version
See also:
https://debian-administration.org/article/726/Performing_IMAP_queries_via_curl