本文整理汇总了PHP中message::set_to方法的典型用法代码示例。如果您正苦于以下问题:PHP message::set_to方法的具体用法?PHP message::set_to怎么用?PHP message::set_to使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message
的用法示例。
在下文中一共展示了message::set_to方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
//.........这里部分代码省略.........
$boundary = trim(str_replace(array("'", '"'), '', $parts[1]));
}
continue;
}
// Explode them out
list($name, $content) = explode(':', trim($header), 2);
// Cleanup crew
$name = trim($name);
$content = trim($content);
switch (strtolower($name)) {
// Mainly for legacy -- process a From: header if it's there
case 'from':
if (strpos($content, '<') !== false) {
// So... making my life hard again?
$from_name = substr($content, 0, strpos($content, '<') - 1);
$from_name = str_replace('"', '', $from_name);
$from_name = trim($from_name);
$from_email = substr($content, strpos($content, '<') + 1);
$from_email = str_replace('>', '', $from_email);
$from_email = trim($from_email);
} else {
$from_name = trim($content);
}
break;
case 'content-type':
if (strpos($content, ';') !== false) {
list($type, $charset) = explode(';', $content);
$content_type = trim($type);
if (false !== stripos($charset, 'charset=')) {
$charset = trim(str_replace(array('charset=', '"'), '', $charset));
} elseif (false !== stripos($charset, 'boundary=')) {
$boundary = trim(str_replace(array('BOUNDARY=', 'boundary=', '"'), '', $charset));
$charset = '';
}
} else {
$content_type = trim($content);
}
break;
case 'cc':
$cc = array_merge((array) $cc, explode(',', $content));
break;
case 'bcc':
$bcc = array_merge((array) $bcc, explode(',', $content));
break;
default:
// Add it to our grand headers array
$headers[trim($name)] = trim($content);
break;
}
}
}
}
// From email and name
// If we don't have a name from the input headers
if (!isset($from_name)) {
$from_name = '';
}
/* If we don't have an email from the input headers default to $noreply
* Some hosts will block outgoing mail from this address if it doesn't exist but
* there's no easy alternative. Defaulting to admin_email might appear to be another
* option but some hosts may refuse to relay mail from an unknown domain. See
* http://trac.wordpress.org/ticket/5007.
*/
if (!isset($from_email)) {
// Get the site domain and get rid of www.
$sitename = strtolower($_SERVER['SERVER_NAME']);
if (substr($sitename, 0, 4) == 'www.') {
$sitename = substr($sitename, 4);
}
$from_email = $replyto;
}
// Set destination addresses
if (!is_array($to)) {
$to = explode(',', $to);
}
// Set Content-Type and charset
// If we don't have a content-type from the input headers
if (!isset($content_type)) {
$content_type = 'text/html';
}
$content_type = apply_filters('wp_mail_content_type', $content_type);
$msg = new message($content_type, $log, $debug, $logpath);
$msg->set_to($to);
$msg->set_cc($cc);
$msg->set_bcc($bcc);
$msg->set_subject($subject);
$msg->set_bodyContent(nl2br($message));
if (!empty($attachments)) {
foreach ($attachments as $attachment) {
$msg->set_attachByPathOnAppServer(basename($attachment), $attachment);
}
}
//add message to mailsender
if (!$sender->add($msg)) {
return false;
}
// Send!
$result = $sender->send_mail();
return $result;
}
示例2: sendMail
/**
* Checks if the user is member of clients group and if it should be member of it
* @author Albert Pérez Monfort
* @return bool true authetication succesful
*/
public static function sendMail(Zikula_Event $event) {
$args = $event->getArgs();
/*
$args['html'] = FormUtil::getPassedValue('html', isset($args['html']) ? $args['html'] : 0, 'POST');
$args['toaddress'] = FormUtil::getPassedValue('toaddress', isset($args['toaddress']) ? $args['toaddress'] : null, 'POST');
$args['cc'] = FormUtil::getPassedValue('cc', isset($args['cc']) ? $args['cc'] : null, 'POST');
$args['bcc'] = FormUtil::getPassedValue('bcc', isset($args['bcc']) ? $args['bcc'] : null, 'POST');
$args['subject'] = FormUtil::getPassedValue('subject', isset($args['subject']) ? $args['subject'] : null, 'POST');
$args['body'] = FormUtil::getPassedValue('body', isset($args['body']) ? $args['body'] : null, 'POST');
$args['attachments'] = FormUtil::getPassedValue('attachments', isset($args['attachments']) ? $args['attachments'] : array(), 'POST');
$args['stringattachments'] = FormUtil::getPassedValue('stringattachments', isset($args['stringattachments']) ? $args['stringattachments'] : array(), 'POST');
$args['embeddedimages'] = FormUtil::getPassedValue('embeddedimages', isset($args['embeddedimages']) ? $args['embeddedimages'] : array(), 'POST');
*/
// include php mailsender class file
if (file_exists($file = "modules/SiriusXtecMailer/includes/mailsender.class.php")) {
require_once($file);
} else {
return false;
}
// include php message class file
if (file_exists($file = "modules/SiriusXtecMailer/includes/message.class.php")) {
require_once($file);
} else {
return false;
}
$enabled = ModUtil::getVar('SiriusXtecMailer', 'enabled');
if ($enabled == 0) {
// Add processed flag
//$args['processed'] = 1;
//$result = ModUtil::apiFunc('Mailer', 'user', 'sendmessage', $args);
//return $result;
return false;
}
$idApp = ModUtil::getVar('SiriusXtecMailer', 'idApp');
$replyAddress = ModUtil::getVar('SiriusXtecMailer', 'replyAddress');
$sender = ModUtil::getVar('SiriusXtecMailer', 'sender');
$environment = ModUtil::getVar('SiriusXtecMailer','environment');
$log = ModUtil::getVar('SiriusXtecMailer', 'log');
$debug = ModUtil::getVar('SiriusXtecMailer', 'debug');
$logpath = ModUtil::getVar('SiriusXtecMailer', 'logpath');
$mail = new mailsender($idApp, $replyAddress, $sender, $environment, $log, $debug, $logpath);
// add body content type
$contenttypes = ModUtil::func('SiriusXtecMailer', 'admin', 'getContentTypes');
// set HTML mail if required
if (isset($args['html']) && is_bool($args['html'])) {
if ($args['html']) {
$bodyType = 'text/html';
} else {
$bodyType = TEXTPLAIN;
}
} else {
$bodyType = $contenttypes[ModUtil::getVar('SiriusXtecMailer', 'contenttype')];
}
$message = new message($bodyType, $log, $debug, $logpath);
// add any to addresses
if (is_array($args['toaddress'])) {
foreach ($args['toaddress'] as $to) {
$message->set_to($to);
}
} else {
// $toaddress is not an array -> old logic
// process multiple names entered in a single field separated by commas (#262)
foreach (explode(',', $args['toaddress']) as $to) {
$message->set_to($to);
}
}
// add any cc addresses
if (isset($args['cc']) && is_array($args['cc'])) {
foreach ($args['cc'] as $cc) {
$message->set_cc($cc['address']);
}
}
// add any bcc addresses
if (isset($args['bcc']) && is_array($args['bcc'])) {
foreach ($args['bcc'] as $bcc) {
$message->set_bcc($bcc['address']);
}
}
// add message subject and body
$subject = $args['subject'];
$message->set_subject($subject);
$body = $args['body'];
$message->set_bodyContent($body);
//.........这里部分代码省略.........