本文整理汇总了PHP中Mailer::set_charset方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::set_charset方法的具体用法?PHP Mailer::set_charset怎么用?PHP Mailer::set_charset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mailer
的用法示例。
在下文中一共展示了Mailer::set_charset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Wanewsletter
function Wanewsletter($listdata = null)
{
global $nl_config, $lang;
require WAMAILER_DIR . '/class.mailer.php';
$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);
$this->mailer =& $mailer;
if (isset($listdata)) {
$this->listdata = $listdata;
$this->liste_email = !empty($listdata['liste_alias']) ? $listdata['liste_alias'] : $listdata['sender_email'];
if ($listdata['liste_format'] == FORMAT_TEXTE || $listdata['liste_format'] == FORMAT_HTML) {
$this->format = $listdata['liste_format'];
}
}
}
示例2: IN
}
$sql = "SELECT liste_id, log_id, log_subject, log_body_text, log_body_html \n\t\t\t\tFROM " . LOG_TABLE . " \n\t\t\t\tWHERE log_id IN(" . implode(', ', $sql_log_id) . ") \n\t\t\t\t\tAND log_status = " . STATUS_SENDED;
if (!($result = $db->query($sql))) {
trigger_error('Impossible de récupérer la liste des archives', ERROR);
}
require WAMAILER_DIR . '/class.mailer.php';
require WA_ROOTDIR . '/includes/class.attach.php';
//
// 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']);
if ($abodata['pseudo'] != '') {
$address = array($abodata['pseudo'] => $abodata['email']);
} else {
$address = $abodata['email'];
}
$lang['CHARSET'] = strtoupper($lang['CHARSET']);
$lang['Label_link::utf8'] = wan_utf8_encode($lang['Label_link']);
while ($row = $result->fetch()) {
$listdata = $abodata['listes'][$row['liste_id']];
$format = $abodata['listes'][$row['liste_id']]['format'];
//
// On traite les données de la newsletter à envoyer
//
if (preg_match('/[\\x80-\\x9F]/', $row['log_subject']) || preg_match('/[\\x80-\\x9F]/', $row['log_body_text']) || preg_match('/[\\x80-\\x9F]/', $row['log_body_html'])) {
if (TRANSLITE_INVALID_CHARS == false) {
示例3: Mailer
if (!($result = $db->query($sql))) {
trigger_error('Impossible d\'obtenir les informations du compte', CRITICAL_ERROR);
}
if (!($admin_id = $result->column('admin_id'))) {
$error = TRUE;
$msg_error[] = $lang['Message']['Error_sendpass'];
}
if (!$error) {
$new_password = generate_key(12);
require WAMAILER_DIR . '/class.mailer.php';
$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($email);
$mailer->set_address($email);
$mailer->set_subject($lang['Subject_email']['New_pass']);
$mailer->use_template('new_admin_pass', array('PSEUDO' => $login, 'PASSWORD' => $new_password));
if (!$mailer->send()) {
trigger_error('Failed_sending', ERROR);
}
$db->query("UPDATE " . ADMIN_TABLE . "\n\t\t\t\tSET admin_pwd = '" . md5($new_password) . "'\n\t\t\t\tWHERE admin_id = " . $admin_id);
$output->message('IDs_sended');
}
}
$output->page_header();
$output->set_filenames(array('body' => 'sendpass_body.tpl'));
$output->assign_vars(array('TITLE' => $lang['Title']['sendpass'], 'L_LOGIN' => $lang['Login'], 'L_EMAIL' => $lang['Email_address'], 'L_VALID_BUTTON' => $lang['Button']['valid'], 'S_LOGIN' => htmlspecialchars($login), 'S_EMAIL' => htmlspecialchars($email)));
示例4: array
/**
* launch_sending()
*
* Cette fonction est appellée soit dans envoi.php lors de l'envoi, soit
* dans le fichier appellé originellement cron.php
*
* @param array $listdata Tableau des données de la liste concernée
* @param array $logdata Tableau des données de la newsletter
* @param array $supp_address Adresses de destinataires supplémentaires
*
* @return string
*/
function launch_sending($listdata, $logdata, $supp_address = array())
{
global $nl_config, $db, $lang, $other_tags;
//
// On commence par poser un verrou sur un fichier lock,
// il ne faut pas qu'il y ait simultanément plusieurs flôts d'envois
// pour une même liste de diffusion.
//
$lockfile = sprintf(WA_LOCKFILE, $listdata['liste_id']);
if (file_exists($lockfile)) {
$isBeginning = false;
$fp = fopen($lockfile, 'r+');
$supp_address = array();
// On en tient pas compte, ça l'a déjà été lors du premier flôt
} else {
$isBeginning = true;
$fp = fopen($lockfile, 'w');
@chmod($lockfile, 0600);
}
if (!flock($fp, LOCK_EX | LOCK_NB)) {
fclose($fp);
return $lang['Message']['List_is_busy'];
}
if (filesize($lockfile) > 0) {
//
// L'envoi a planté au cours d'un "flôt" précédent. On récupère les éventuels
// identifiants d'abonnés stockés dans le fichier lock et on met à jour la table
//
$abo_ids = fread($fp, filesize($lockfile));
$abo_ids = array_map('trim', explode("\n", trim($abo_ids)));
if (count($abo_ids) > 0) {
$abo_ids = array_unique(array_map('intval', $abo_ids));
$sql = "UPDATE " . ABO_LISTE_TABLE . "\n\t\t\t\tSET send = 1\n\t\t\t\tWHERE abo_id IN(" . implode(', ', $abo_ids) . ")\n\t\t\t\t\tAND liste_id = " . $listdata['liste_id'];
if (!$db->query($sql)) {
trigger_error('Impossible de mettre à jour la table des abonnés', ERROR);
}
}
ftruncate($fp, 0);
fseek($fp, 0);
}
//
// Initialisation de la classe mailer
//
require WAMAILER_DIR . '/class.mailer.php';
$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_from($listdata['sender_email'], unhtmlspecialchars($listdata['liste_name']));
if ($listdata['return_email'] != '') {
$mailer->set_return_path($listdata['return_email']);
}
//
// On traite les données de la newsletter à envoyer
//
if (preg_match('/[\\x80-\\x9F]/', $logdata['log_subject']) || preg_match('/[\\x80-\\x9F]/', $logdata['log_body_text']) || preg_match('/[\\x80-\\x9F]/', $logdata['log_body_html'])) {
if (TRANSLITE_INVALID_CHARS == false) {
$logdata['log_subject'] = wan_utf8_encode($logdata['log_subject']);
$logdata['log_body_text'] = wan_utf8_encode($logdata['log_body_text']);
$logdata['log_body_html'] = wan_utf8_encode($logdata['log_body_html']);
$lang['Label_link'] = wan_utf8_encode($lang['Label_link']);
$mailer->set_charset('UTF-8');
} else {
$logdata['log_subject'] = purge_latin1($logdata['log_subject'], true);
$logdata['log_body_text'] = purge_latin1($logdata['log_body_text'], true);
$logdata['log_body_html'] = purge_latin1($logdata['log_body_html']);
}
}
$mailer->set_subject($logdata['log_subject']);
$body = array(FORMAT_TEXTE => $logdata['log_body_text'], FORMAT_HTML => $logdata['log_body_html']);
//
// Ajout du lien de désinscription, selon les méthodes d'envoi/format utilisés
//
$link = newsletter_links($listdata);
if ($listdata['use_cron'] || $nl_config['engine_send'] == ENGINE_BCC) {
$body[FORMAT_TEXTE] = str_replace('{LINKS}', $link[FORMAT_TEXTE], $body[FORMAT_TEXTE]);
$body[FORMAT_HTML] = str_replace('{LINKS}', $link[FORMAT_HTML], $body[FORMAT_HTML]);
}
//
// On s'occupe maintenant des fichiers joints ou incorporés
// Si les fichiers sont stockés sur un serveur ftp, on les rapatrie le temps du flot d'envoi
//
$total_files = count($logdata['joined_files']);
$tmp_files = array();
require WA_ROOTDIR . '/includes/class.attach.php';
$attach = new Attach();
//.........这里部分代码省略.........