if ($email->type == TYPEMULTIPART && isset($email->parts[1]) && $email->parts[1]->type == TYPEMESSAGE && $email->parts[1]->ifsubtype == true && $email->parts[1]->subtype == 'DELIVERY-STATUS') { $body = imap_fetchbody($cid, $mail_id, 2, FT_PEEK); plain_error($body); $deleted_mails[] = process_bounce($body); // // On supprime l'email maintenant devenu inutile // //imap_delete($cid, $mail_id); } } imap_close($cid, CL_EXPUNGE); } else { require 'Mail/mimeDecode.php'; require WAMAILER_DIR . '/class.pop.php'; $pop = new Pop(); $pop->connect($pop_server, $pop_port, $pop_user, $pop_passwd); $total = $pop->stat_box(); $mail_box = $pop->list_mail(); $deleted_mails = array(); foreach ($mail_box as $mail_id => $mail_size) { $headers = $pop->contents[$mail_id]['headers']; $message = $pop->contents[$mail_id]['message']; $decode = new Mail_mimeDecode($headers . "\r\n\r\n" . $message, "\r\n"); $email = $decode->decode(array('include_bodies' => true, 'decode_bodies' => true)); if ($email->ctype_primary == 'multipart' && $email->ctype_secondary == 'report' && $email->ctype_parameters['report-type'] == 'delivery-status' && isset($email->parts[1]) && $email->parts[1]->ctype_primary == 'message' && $email->parts[1]->ctype_secondary == 'delivery-status') { $deleted_mails[] = process_bounce($email->parts[1]->body); // // On supprime l'email maintenant devenu inutile // //$pop->delete_mail($mail_id); }
} if (!empty($return_email) && Mailer::validate_email($return_email) == false) { $error = TRUE; $msg_error[] = $lang['Message']['Invalid_email']; } if (!empty($liste_alias) && Mailer::validate_email($liste_alias) == false) { $error = TRUE; $msg_error[] = $lang['Message']['Invalid_email']; } if (empty($pop_pass) && $action == 'edit') { $pop_pass = $listdata['pop_pass']; } if ($use_cron && function_exists('fsockopen')) { require WAMAILER_DIR . '/class.pop.php'; $pop = new Pop(); $result = $pop->connect($pop_host, $pop_port, $pop_user, $pop_pass); if (!$result) { $error = TRUE; $msg_error[] = sprintf(nl2br($lang['Message']['bad_pop_param']), htmlspecialchars($pop->msg_error)); } else { $pop->quit(); } } else { $use_cron = 0; } if (!$error) { $sql_data = $sql_where = array(); $liste_name = htmlspecialchars($liste_name); $vararray = array_merge($vararray, $vararray2); foreach ($vararray as $varname) { $sql_data[$varname] = ${$varname};
// Initialisation de la classe mailer // $mailer = new Mailer(WA_ROOTDIR . '/language/email_' . $nl_config['language'] . '/'); if ($nl_config['use_smtp']) { $mailer->smtp_path = WAMAILER_DIR . '/'; $mailer->use_smtp($nl_config['smtp_host'], $nl_config['smtp_port'], $nl_config['smtp_user'], $nl_config['smtp_pass']); } $mailer->set_charset($lang['CHARSET']); $mailer->set_format(FORMAT_TEXTE); $mailer->set_from($listdata['sender_email'], unhtmlspecialchars($listdata['liste_name'])); if ($listdata['return_email'] != '') { $mailer->set_return_path($listdata['return_email']); } $wan = new Wanewsletter($listdata); $pop = new Pop(); $pop->connect($listdata['pop_host'], $listdata['pop_port'], $listdata['pop_user'], $listdata['pop_pass']); $cpt = 0; $total = $pop->stat_box(); $mail_box = $pop->list_mail(); foreach ($mail_box as $mail_id => $mail_size) { $headers = $pop->parse_headers($mail_id); if (!isset($headers['from']) || !preg_match('/^(?:"?([^"]*?)"?)?[ ]*(?:<)?([^> ]+)(?:>)?$/i', $headers['from'], $match)) { continue; } $pseudo = isset($match[1]) ? strip_tags(trim($match[1])) : ''; $email = trim($match[2]); if (!isset($headers['to']) || !stristr($headers['to'], $wan->liste_email)) { continue; } if (!isset($headers['subject'])) { continue;