Php
$ch = curl_init();
if($ch) {
/* Set username and password */
curl_setopt($ch, CURLOPT_USERNAME, "user");
curl_setopt($ch, CURLOPT_PASSWORD, "secret");
/* This will fetch message 1 from the user's inbox */
curl_setopt($ch, CURLOPT_URL, "imap://imap.example.com/INBOX/;UID=1");
$proxy = '127.0.0.1:8888';
//$proxyauth = 'user:password';
curl_setopt($ch, CURLOPT_PROXY, $proxy);
//curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
/* Perform the fetch */
$res = curl_exec($ch);
/* Always cleanup */
curl_close($ch);
}
Resources
http://curl.haxx.se/libcurl/c/imap-fetch.html