<code c remote-mail.are>
SERVER = "mail.example.com";
IMAPURL = strcat("imap://", SERVER);
SMTPURL = strcat("smtp://", SERVER);
USR = "user";
PWD = "password";
KEEP = 1;
AUTORESPOND = 0;
RESPONDTO = "test@example.com";
cnt = nb_mail_list(USR, PWD, IMAPURL);
if (cnt < 0) {
printf("ERROR: unable to list mail on %s\n", SERVER);
exit(1);
}
printf("saw %d mails on %s\n\n", cnt, SERVER);
for (i = 0; i < cnt; i++) {
mail = nb_mail_fetch(USR, PWD, IMAPURL, i);
if (!mail) {
printf("ERROR: unable to retrieve mail #%d\n", i);