本文整理汇总了PHP中Zend\Mail\Message::addBCC方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::addBCC方法的具体用法?PHP Message::addBCC怎么用?PHP Message::addBCC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Mail\Message
的用法示例。
在下文中一共展示了Message::addBCC方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValid
/**
* @return Message
*/
public static function getValid()
{
$message = new Message();
$message->setFrom(MailWrapperTestBootstrap::$from);
$message->addTo(MailWrapperTestBootstrap::$toAddresses[0]);
$message->addTo(MailWrapperTestBootstrap::$toAddresses[1]);
$message->addCC(MailWrapperTestBootstrap::$ccAddresses[0]);
$message->addCC(MailWrapperTestBootstrap::$ccAddresses[1]);
$message->addBCC(MailWrapperTestBootstrap::$bccAddresses[0]);
$message->addBCC(MailWrapperTestBootstrap::$bccAddresses[1]);
$message->addReplyTo(MailWrapperTestBootstrap::$alternate);
$message->setSubject(MailWrapperTestBootstrap::$subject);
$message->setBody(MailWrapperTestBootstrap::$contentText);
return $message;
}
示例2: send
public function send(Email $email)
{
$message = new Message();
$config = $this->config;
if ($email->get('from')) {
$fromName = null;
if (!empty($this->params['fromName'])) {
$fromName = $this->params['fromName'];
} else {
$fromName = $config->get('outboundEmailFromName');
}
$message->addFrom(trim($email->get('from')), $fromName);
} else {
if (!empty($this->params['fromAddress'])) {
$fromAddress = $this->params['fromAddress'];
} else {
if (!$config->get('outboundEmailFromAddress')) {
throw new Error('outboundEmailFromAddress is not specified in config.');
}
$fromAddress = $config->get('outboundEmailFromAddress');
}
if (!empty($this->params['fromName'])) {
$fromName = $this->params['fromName'];
} else {
$fromName = $config->get('outboundEmailFromName');
}
$message->addFrom($fromAddress, $fromName);
}
$value = $email->get('to');
if ($value) {
$arr = explode(';', $value);
if (is_array($arr)) {
foreach ($arr as $address) {
$message->addTo(trim($address));
}
}
}
$value = $email->get('cc');
if ($value) {
$arr = explode(';', $value);
if (is_array($arr)) {
foreach ($arr as $address) {
$message->addCC(trim($address));
}
}
}
$value = $email->get('bcc');
if ($value) {
$arr = explode(';', $value);
if (is_array($arr)) {
foreach ($arr as $address) {
$message->addBCC(trim($address));
}
}
}
$message->setSubject($email->get('name'));
$body = new MimeMessage();
$parts = array();
if ($email->get('isHtml')) {
$bodyPart = new MimePart($email->getBodyForSending());
$bodyPart->type = 'text/html';
$bodyPart->charset = 'utf-8';
} else {
if ($email->get('bodyPlain')) {
$bodyPart = new MimePart($email->get('bodyPlain'));
} else {
$bodyPart = new MimePart($email->get('body'));
}
$bodyPart->type = 'text/plain';
$bodyPart->charset = 'utf-8';
}
$parts[] = $bodyPart;
$aCollection = $email->get('attachments');
if (!empty($aCollection)) {
foreach ($aCollection as $a) {
$fileName = 'data/upload/' . $a->id;
$attachment = new MimePart(file_get_contents($fileName));
$attachment->disposition = Mime::DISPOSITION_ATTACHMENT;
$attachment->encoding = Mime::ENCODING_BASE64;
$attachment->filename = $a->get('name');
if ($a->get('type')) {
$attachment->type = $a->get('type');
}
$parts[] = $attachment;
}
}
$aCollection = $email->getInlineAttachments();
if (!empty($aCollection)) {
foreach ($aCollection as $a) {
$fileName = 'data/upload/' . $a->id;
$attachment = new MimePart(file_get_contents($fileName));
$attachment->disposition = Mime::DISPOSITION_INLINE;
$attachment->encoding = Mime::ENCODING_BASE64;
$attachment->id = $a->id;
if ($a->get('type')) {
$attachment->type = $a->get('type');
}
$parts[] = $attachment;
}
}
//.........这里部分代码省略.........
示例3: send
public function send(Email $email, $params = array(), &$message = null, $attachmetList = [])
{
if (!$message) {
$message = new Message();
}
$config = $this->config;
$params = $this->params + $params;
if ($email->get('from')) {
$fromName = null;
if (!empty($params['fromName'])) {
$fromName = $params['fromName'];
} else {
$fromName = $config->get('outboundEmailFromName');
}
$message->addFrom(trim($email->get('from')), $fromName);
} else {
if (!empty($params['fromAddress'])) {
$fromAddress = $params['fromAddress'];
} else {
if (!$config->get('outboundEmailFromAddress')) {
throw new Error('outboundEmailFromAddress is not specified in config.');
}
$fromAddress = $config->get('outboundEmailFromAddress');
}
if (!empty($params['fromName'])) {
$fromName = $params['fromName'];
} else {
$fromName = $config->get('outboundEmailFromName');
}
$message->addFrom($fromAddress, $fromName);
}
if (!$email->get('from')) {
$email->set('from', $fromAddress);
}
if (!empty($params['replyToAddress'])) {
$replyToName = null;
if (!empty($params['replyToName'])) {
$replyToName = $params['replyToName'];
}
$message->setReplyTo($params['replyToAddress'], $replyToName);
}
$value = $email->get('to');
if ($value) {
$arr = explode(';', $value);
if (is_array($arr)) {
foreach ($arr as $address) {
$message->addTo(trim($address));
}
}
}
$value = $email->get('cc');
if ($value) {
$arr = explode(';', $value);
if (is_array($arr)) {
foreach ($arr as $address) {
$message->addCC(trim($address));
}
}
}
$value = $email->get('bcc');
if ($value) {
$arr = explode(';', $value);
if (is_array($arr)) {
foreach ($arr as $address) {
$message->addBCC(trim($address));
}
}
}
$value = $email->get('replyTo');
if ($value) {
$arr = explode(';', $value);
if (is_array($arr)) {
foreach ($arr as $address) {
$message->addReplyTo(trim($address));
}
}
}
$attachmentPartList = array();
$attachmentCollection = $email->get('attachments');
$attachmentInlineCollection = $email->getInlineAttachments();
foreach ($attachmetList as $attachment) {
$attachmentCollection[] = $attachment;
}
if (!empty($attachmentCollection)) {
foreach ($attachmentCollection as $a) {
$fileName = 'data/upload/' . $a->id;
$attachment = new MimePart(file_get_contents($fileName));
$attachment->disposition = Mime::DISPOSITION_ATTACHMENT;
$attachment->encoding = Mime::ENCODING_BASE64;
$attachment->filename = $a->get('name');
if ($a->get('type')) {
$attachment->type = $a->get('type');
}
$attachmentPartList[] = $attachment;
}
}
if (!empty($attachmentInlineCollection)) {
foreach ($attachmentInlineCollection as $a) {
$fileName = 'data/upload/' . $a->id;
$attachment = new MimePart(file_get_contents($fileName));
//.........这里部分代码省略.........