This shows you the differences between two versions of the page.
Last revision | |||
— | sdk:scripts:remote-mail [2015/05/05 15:04] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== SDK Script remote-mail.are ====== | ||
+ | <code c remote-mail.are> | ||
+ | /* DESC: This script reads and sends mails from a remote IMAP/ | ||
+ | * Copyright (C) 2014 NetModule AG, Switzerland | ||
+ | */ | ||
+ | |||
+ | SERVER = " | ||
+ | IMAPURL = strcat(" | ||
+ | SMTPURL = strcat(" | ||
+ | USR = " | ||
+ | PWD = " | ||
+ | KEEP = 1; | ||
+ | AUTORESPOND = 0; | ||
+ | RESPONDTO = " | ||
+ | |||
+ | |||
+ | cnt = nb_mail_list(USR, | ||
+ | if (cnt < 0) { | ||
+ | printf(" | ||
+ | exit(1); | ||
+ | } | ||
+ | |||
+ | printf(" | ||
+ | |||
+ | for (i = 0; i < cnt; i++) { | ||
+ | mail = nb_mail_fetch(USR, | ||
+ | if (!mail) { | ||
+ | printf(" | ||
+ | continue; | ||
+ | } | ||
+ | |||
+ | /* dump mail */ | ||
+ | printf(" | ||
+ | printf(" | ||
+ | printf(" | ||
+ | printf(" | ||
+ | printf(" | ||
+ | printf(" | ||
+ | |||
+ | | ||
+ | if (AUTORESPOND) { | ||
+ | /* auto-respond to sender */ | ||
+ | m = strstr(struct_get(mail, | ||
+ | if (!is_void(m)) { | ||
+ | printf(" | ||
+ | |||
+ | response = mkstruct(" | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | |||
+ | if (nb_mail_send(USR, | ||
+ | printf(" | ||
+ | } else { | ||
+ | printf(" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if (!KEEP) { | ||
+ | if (nb_mail_delete(USR, | ||
+ | printf(" | ||
+ | } else { | ||
+ | printf(" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | exit(0); | ||
+ | </ | ||