本文整理汇总了PHP中Zend\Mail\Message::setTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::setTo方法的具体用法?PHP Message::setTo怎么用?PHP Message::setTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Mail\Message
的用法示例。
在下文中一共展示了Message::setTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
public function send($fromAddress, $fromName, $replyToAddress, $replyToName, $toAddress, $toName, $subject, array $mimeParts)
{
$mail = new Message();
if ($fromAddress && $fromName) {
$mail->setFrom($fromAddress, $fromName);
} else {
if ($fromAddress) {
$mail->setFrom($fromAddress);
}
}
if ($replyToAddress && $replyToName) {
$mail->setReplyTo($replyToAddress, $replyToName);
} else {
if ($replyToAddress) {
$mail->setReplyTo($replyToAddress);
}
}
if ($toAddress && $toName) {
$mail->setTo($toAddress, $toName);
} else {
if ($toAddress) {
$mail->setTo($toAddress);
}
}
$mail->setSubject($subject);
$mail->setEncoding('utf-8');
$mime = new MimeMessage();
$mime->setParts($mimeParts);
$mail->setBody($mime);
$this->mailTransport->send($mail);
$this->getEventManager()->trigger('send', $mail);
}
示例2: sendMail
/**
* @param string $subject
* @param string $message
* @param null|string|array $to
* @param null|string|array $cc
* @param null|string|array $bcc
* @return array
*/
public function sendMail($subject, $message, $to = null, $cc = null, $bcc = null)
{
$return = array('success' => true, 'msg' => null);
$partBody = new MimePart($this->getPartHeader() . $message . $this->getPartFooter());
$partBody->type = Mime::TYPE_HTML;
$partBody->charset = 'utf-8';
$this->body->setParts(array($partBody));
$subject = '[' . APPLICATION_NAME . '] ' . $subject;
$mail = new Message();
$mail->addFrom(self::FROM);
$mail->setSubject($subject);
$mail->setBody($this->body);
$mail->setTo($to);
if ($cc) {
$mail->setCc($cc);
}
if ($bcc) {
$mail->setBcc($bcc);
}
try {
$this->transport->send($mail);
} catch (\Exception $e) {
$return['success'] = false;
$return['msg'] = _('mail.message.not_sent');
//throw new \Exception($e->getMessage(), $e->getCode());
}
return $return;
}
示例3: sendEmail
public function sendEmail($from, $to, $cc, $subject, $body, $attachmentFilename)
{
$message = new Message();
$message->setFrom($from);
$message->setTo($to);
$message->setCc($cc);
$message->setSubject($subject);
$mimeMessage = new \Zend\Mime\Message();
$part = new \Zend\Mime\Part($body);
$part->setType(Mime::TYPE_TEXT);
$part->setCharset('UTF-8');
$mimeMessage->addPart($part);
$part = new \Zend\Mime\Part('<p>' . $body . '<p>');
$part->setType(Mime::TYPE_HTML);
$part->setCharset('UTF-8');
$mimeMessage->addPart($part);
$part = new \Zend\Mime\Part($body);
$part->setType(Mime::TYPE_OCTETSTREAM);
$part->setEncoding(Mime::ENCODING_BASE64);
$part->setFileName($attachmentFilename);
$part->setDisposition(Mime::DISPOSITION_ATTACHMENT);
$mimeMessage->addPart($part);
$message->setBody($mimeMessage);
$this->transport->send($message);
$this->debugSection('ZendMailer', $subject . ' ' . $from . ' -> ' . $to);
}
示例4: setRecipient
/**
* Set email recipient
*
* @param array $variables
* @return Mailer
*/
public function setRecipient($email, $name)
{
if ($this->message) {
$this->message->setTo($email, $name);
}
return $this;
}
示例5: send
/**
* @param \Zend\Mail\Message $message
* @param string $toEmail
*
* @return string
*/
public function send($message, $toEmail)
{
if (YII_ENV == 'test' || mb_strpos($toEmail, '@example.org') !== false) {
return Email::STATUS_SKIPPED_OTHER;
}
$message->setTo($toEmail);
$transport = $this->getTransport();
$transport->send($message);
return Email::STATUS_SENT;
}
示例6: sendInvoiceWithParams
public function sendInvoiceWithParams(Invoice $invoice, Parameters $data)
{
$message = new Message();
$message->setTo($data->to);
$message->setFrom($data->from);
$message->setSubject($data->header);
$message->setBody($data->content);
$parts[] = $this->getAttachment($data->file, $data->fileName);
$this->send($data->transport, $message, $parts);
}
示例7: sendMail
public function sendMail($from, $name, $message)
{
$mail = new Message();
$mail->setBody($message);
$mail->setFrom($from, $name);
$mail->setTo(self::EMAIL_ADMIN, 'Their name');
$mail->setSubject('Test Subject');
//Todo config le smtp
// $transport = new Transport\Sendmail();
// $transport->send($mail);
}
示例8: getMessage
/**
* @param string $tpl
* @param array $data
* @return Message
*/
public function getMessage($tpl, array $data)
{
$mail = new Message();
$mail->setEncoding('UTF-8');
if (isset($data['encoding'])) {
$mail->setEncoding($data['encoding']);
}
if (isset($data['from_address'])) {
if (isset($data['from_name'])) {
$mail->setFrom($data['from_address'], $data['from_name']);
} else {
$mail->setFrom($data['from_address']);
}
}
if (isset($data['to'])) {
if (isset($data['to_name'])) {
$mail->setTo($data['to'], $data['to_name']);
} else {
$mail->setTo($data['to']);
}
}
if (isset($data['cc'])) {
$mail->setCc($data['cc']);
}
if (isset($data['bcc'])) {
$mail->setBcc($data['bcc']);
}
if (isset($data['subject'])) {
$mail->setSubject($data['subject']);
}
if (isset($data['sender'])) {
$mail->setSender($data['sender']);
}
if (isset($data['replyTo'])) {
$mail->setReplyTo($data['replyTo']);
}
$content = $this->renderMail($tpl, $data);
$mail->setBody($content);
$mail->getHeaders()->addHeaderLine('Content-Type', 'text/html; charset=UTF-8')->addHeaderLine('Content-Transfer-Encoding', '8bit');
return $mail;
}
示例9: sendMessage
protected function sendMessage($to, $from, $subject, Mime\Message $body, $headers = false)
{
$message = new Mail\Message();
$message->setTo($to);
$message->setFrom($from);
$message->setSubject($subject);
$message->setBody($body);
if ($headers) {
$message->getHeaders()->addHeaders($headers);
}
return $this->client->sendRawEmail(array('Source' => $from, 'Destinations' => array($to), 'RawMessage' => array('Data' => $this->getMessageText($message))));
}
示例10: createMessage
/**
* @param ZendMailInterface $mail
*
* @return Mail\Message
*/
protected function createMessage(ZendMailInterface $mail)
{
$message = new Mail\Message();
$message->getHeaders()->addHeaders($mail->getHeaders());
$message->setTo($mail->getTo());
$message->setCc($mail->getCc());
$message->setBcc($mail->getBcc());
$message->setFrom($mail->getFrom());
$message->setReplyTo($mail->getReplyTo());
$message->setSubject($mail->getSubject());
$message->setBody($this->messageCreator->createMessage($mail));
return $message;
}
示例11: sendVerificationEmailMessage
public function sendVerificationEmailMessage(Model $record)
{
$fromAddress = $this->getEmailMessageOptions()->getEmailFromAddress();
$subject = $this->getEmailMessageOptions()->getVerificationEmailSubjectLine();
$message = new EmailMessage();
$message->setFrom($fromAddress);
$message->setTo($record->getEmailAddress());
$message->setSubject($subject);
$viewModel = new ViewModel(array('record' => $record));
$viewModel->setTerminal(true)->setTemplate('cdli-twostagesignup/email/verification');
$message->setBody($this->emailRenderer->render($viewModel));
$this->emailTransport->send($message);
}
示例12: send
public function send($template, $subject, $recipients, $model)
{
$content = $this->renderer->render("email/{$template}", $model);
$html = new MimePart($content);
$html->type = "text/html";
$body = new MimeMessage();
$body->setParts([$html]);
$mail = new Message();
$mail->setBody($body);
$mail->setFrom($this->from);
$mail->setTo($recipients);
$mail->setSubject($subject);
$this->transport->send($mail);
}
示例13: contruirCorreo
public function contruirCorreo(array $param = null)
{
$mail = new Mail\Message();
$mail->setTo('jgbpqek@gmail.com', 'Jeisson');
//de
$mail->addFrom('jgb_17@hotmail.com');
//para
$mail->setSubject('Clave ingreso');
//asunto
$cfg = array('ssl' => 'tls', 'username' => 'jgbpqek@gmail.com', 'password' => 'JeissonB_1989');
$smtpOption = new Mail\Transport\SmtpOptions();
$smtpOption->setHost('smtp.gmail.com')->setConnectionClass('login')->setName('smtp.gmail.com')->setConnectionConfig($cfg);
$smtp = new Mail\Transport\Smtp($smtpOption);
$smtp->send($mail);
}
示例14: send
public function send()
{
$this->logger->log(Logger::INFO, "Sending email to: " . implode(",", $this->recipients));
try {
$message = new Message();
$message->setTo($this->recipients);
$message->setFrom('cf8qde01@gmail.com', "XML generator");
$message->setSubject('The Night Life XML');
$message->setBody($this->prepareMimeMessage());
$this->transport->send($message);
return true;
} catch (\Exception $e) {
$this->logger->log(Logger::ALERT, "Sending email error: " . $e->getMessage());
return false;
}
}
示例15: sendMail
public function sendMail($email, $fullname, $linkActive)
{
$message = new \Zend\Mail\Message();
$smtpOption = new SmtpOptions($this->_config);
$message->setFrom($this->_config['connectionConfig']['username'], "bookStoreOnline");
$message->setTo($email, $fullname);
$message->setSubject("Kích hoạt tài khoản");
$message->setEncoding("utf-8");
//set HTML
$content = new \Zend\Mime\Part("<p>Xin chào " . $fullname . "</p> \n\t\t\t<p>Bạn vừa đăng ký tài khoản tại website BookOnline,\n\t\t\tđể hoàn thành việc đăng ký bạn cui lòng <a href='" . $linkActive . "'>Click vào đây</a>\n\t\t\tđể kích hoạt tài khoản</p>");
$content->type = Mime::TYPE_HTML;
$content->charset = "utf-8";
$mimeMessage = new \Zend\Mime\Message();
$mimeMessage->setParts(array($content));
$message->setBody($mimeMessage);
$transport = new \Zend\Mail\Transport\Smtp($smtpOption);
$transport->send($message);
}