当前位置: 首页>>代码示例>>PHP>>正文


PHP Message::addFrom方法代码示例

本文整理汇总了PHP中Zend\Mail\Message::addFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::addFrom方法的具体用法?PHP Message::addFrom怎么用?PHP Message::addFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Mail\Message的用法示例。


在下文中一共展示了Message::addFrom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendContactMail

 /**
  * Send contact mail
  * @param $controller
  * @param $data
  */
 public static function sendContactMail($controller, $data)
 {
     // prepare html content
     $comments = nl2br($data['comments']);
     // line break
     $content = '';
     $content .= '<table>';
     $content .= '<tbody>';
     $content .= "<tr><td>First Name:</td><td>{$data['firstName']}</td></tr>";
     $content .= "<tr><td>Last Name:</td><td>{$data['lastName']}</td></tr>";
     $content .= "<tr><td>Phone Number:</td><td>{$data['phone']}</td></tr>";
     $content .= "<tr><td>Email:</td><td>{$data['email']}</td></tr>";
     $content .= "<tr><td>Company:</td><td>{$data['company']}</td></tr>";
     $content .= "<tr><td>Job Title:</td><td>{$data['jobTitle']}</td></tr>";
     $content .= "<tr><td>Comments:</td><td>{$comments}</td></tr>";
     $content .= '</tbody>';
     $content .= '</table>';
     $html = new MimePart($content);
     $html->type = "text/html";
     $body = new MimeMessage();
     $body->setParts(array($html));
     $message = new Message();
     $message->setBody($body);
     // subject
     $subject = 'Contact from Papertask';
     $message->setSubject($subject);
     // get transport
     $transport = $controller->getServiceLocator()->get('mail.transport');
     $message->addTo($transport->mailOptions['contact']);
     $message->addFrom($transport->mailOptions['contact']);
     $transport->send($message);
 }
开发者ID:papertask,项目名称:papertask,代码行数:37,代码来源:Mail.php

示例2: add

 /**
  * @param string $queue_name
  * @param \Zend\Mail\Message $mail
  */
 public function add($queue_name, \Zend\Mail\Message $message)
 {
     if (!count($message->getFrom())) {
         $message->addFrom($this->config['default_from']);
     }
     $this->table->add($queue_name, $message);
 }
开发者ID:cobyl,项目名称:ppmodulemailer,代码行数:11,代码来源:Service.php

示例3: 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;
 }
开发者ID:baptcomet,项目名称:weprono,代码行数:36,代码来源:Mailer.php

示例4: run

 public function run()
 {
     $transport = new SmtpTransport(new SmtpOptions(array('name' => $this->host, 'host' => $this->host, 'port' => $this->port, 'connection_config' => array('username' => $this->sender->getUsername(), 'password' => $this->sender->getPassword()))));
     if ($this->auth !== null) {
         $transport->getOptions()->setConnectionClass($this->auth);
     }
     $message = new Message();
     $message->addFrom($this->sender->getUsername())->setSubject($this->subject);
     if ($this->bcc) {
         $message->addBcc($this->recipients);
     } else {
         $message->addTo($this->recipients);
     }
     $body = new MimeMessage();
     if ($this->htmlBody == null) {
         $text = new MimePart($this->textBody);
         $text->type = "text/plain";
         $body->setParts(array($text));
     } else {
         $html = new MimePart($this->htmlBody);
         $html->type = "text/html";
         $body->setParts(array($html));
     }
     $message->setBody($body);
     $transport->send($message);
 }
开发者ID:rmukras,项目名称:ekda.org,代码行数:26,代码来源:EMailServiceWorker.php

示例5: sendMail

 public function sendMail(MailMessage $message)
 {
     $from = $message->getFrom();
     if (count($from) == 0) {
         $message->addFrom($this->createSenderAddress());
     }
     $this->transport->send($message);
 }
开发者ID:RiskioFr,项目名称:Mailer,代码行数:8,代码来源:Mailer.php

示例6: assemble

 /**
  * @param string $to
  * @param Template $template
  * @param array $data
  * @return Message
  */
 public function assemble($to, Template $template, array $data)
 {
     $html = new MimePart($template->getBody($data));
     $html->type = "text/html";
     $body = new MimeMessage();
     $body->addPart($html);
     $message = new Message();
     $message->addFrom($this->config['from-email'], $this->config['from-name'])->addTo($to)->setSubject($template->getSubject())->setBody($body)->setEncoding("UTF-8");
     return $message;
 }
开发者ID:t4web,项目名称:mail,代码行数:16,代码来源:Assembler.php

示例7: testRestoreFromSerializedString

 public function testRestoreFromSerializedString()
 {
     $this->message->addTo('zf-devteam@example.com', 'ZF DevTeam');
     $this->message->addFrom('matthew@example.com', "Matthew Weier O'Phinney");
     $this->message->addCc('zf-contributors@example.com', 'ZF Contributors List');
     $this->message->setSubject('This is a subject');
     $this->message->setBody('foo');
     $serialized = $this->message->toString();
     $restoredMessage = Message::fromString($serialized);
     $this->assertEquals($serialized, $restoredMessage->toString());
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:11,代码来源:MessageTest.php

示例8: createMessage

 private function createMessage()
 {
     $message = new Message();
     $config = $this->config['message'];
     $message->addTo($config['to']);
     if ($config['from']) {
         $message->addFrom($config['from']);
     }
     $message->setSender($config['sender']['address'], $config['sender']['name']);
     return $message;
 }
开发者ID:bcremer,项目名称:mwop.net,代码行数:11,代码来源:Process.php

示例9: sendPasswordLostMail

 /**
  * Send password lost email.
  *
  * @param NewUserModel $activation
  * @param MemberModel $member
  */
 public function sendPasswordLostMail(NewUserModel $newUser, MemberModel $member)
 {
     $body = $this->render('user/email/reset', ['user' => $newUser, 'member' => $member]);
     $translator = $this->getServiceManager()->get('translator');
     $message = new Message();
     $config = $this->getConfig();
     $message->addFrom($config['from']);
     $message->addTo($newUser->getEmail());
     $message->setSubject($translator->translate('Password reset code for the GEWIS Website'));
     $message->setBody($body);
     $this->getTransport()->send($message);
 }
开发者ID:Mesoptier,项目名称:gewisweb,代码行数:18,代码来源:Email.php

示例10: sendRegisterEmail

 /**
  * Send registration email.
  *
  * @param NewUserModel $newUser
  * @param MemberModel $member
  */
 public function sendRegisterEmail(NewUserModel $newUser, MemberModel $member)
 {
     $body = $this->render('user/email/register', array('user' => $newUser, 'member' => $member));
     $translator = $this->getServiceManager()->get('translator');
     $message = new Message();
     $config = $this->getConfig();
     $message->addFrom($config['from']);
     $message->addTo($newUser->getEmail());
     $message->setSubject($translator->translate('Account activation code for the GEWIS Website'));
     $message->setBody($body);
     $this->getTransport()->send($message);
 }
开发者ID:efueger,项目名称:gewisweb,代码行数:18,代码来源:Email.php

示例11: send

 public function send($subject, $messageBody)
 {
     $html = new \Zend\Mime\Part(nl2br($messageBody));
     $html->type = 'text/html';
     $body = new \Zend\Mime\Message();
     $body->setParts(array($html));
     $message = new Message();
     $message->addFrom($this->fromAddress, $this->fromName)->addTo($this->toAddress)->setSubject($subject);
     $message->setBody($body);
     $transport = $this->getTransport();
     $transport->send($message);
 }
开发者ID:KGalley,项目名称:whathood,代码行数:12,代码来源:Email.php

示例12: prepareMail

 protected function prepareMail(MailMessage $mail, array $viewVariables, $mailTemplateName)
 {
     $mailBodyOutput = $this->getRenderContent($viewVariables, $mailTemplateName);
     $mailBodyOutput = htmlspecialchars_decode(htmlentities($mailBodyOutput, ENT_NOQUOTES, 'UTF-8', false), ENT_NOQUOTES);
     $content = new MimeMessage();
     $part = new Part($mailBodyOutput);
     $part->type = 'text/html';
     $content->addPart($part);
     $mail->addFrom($this->mailAddress, $this->senderName);
     $this->addMailTargets($mail);
     $mail->setEncoding('UTF-8');
     $mail->setBody($content);
 }
开发者ID:zend-bricks,项目名称:bricks-common,代码行数:13,代码来源:MailModel.php

示例13: send

 public function send()
 {
     $smtpOptions = new SmtpOptions(array('name' => 'smtp.gmail.com', 'host' => 'smtp.gmail.com', 'connection_class' => 'login', 'connection_config' => array('username' => 'naman.bakliwal@optimusinfo.com', 'password' => 'optimus@123', 'port' => 465, 'ssl' => 'TLS')));
     $html = new MimePart($this->getBody());
     $html->type = "text/html";
     $body = new MimeMessage();
     $body->setParts(array($html));
     $mailTransport = new Smtp();
     $mailTransport->setOptions($smtpOptions);
     $mail = new Message();
     $mail->addFrom('naman.bakliwal@optimusinfo.com', 'Travelopod')->setEncoding('utf-8')->setTo($this->getTo())->setSubject($this->getSubject())->setBody($body);
     $send = $mailTransport->send($mail);
     $mailTransport->disconnect();
 }
开发者ID:nmnb18,项目名称:Aufri.com,代码行数:14,代码来源:MailService.php

示例14: 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);
 }
开发者ID:nathalysalamanca,项目名称:Observatorio,代码行数:15,代码来源:SendMail.php

示例15: sendActivityCreationEmail

 /**
  * Send activity creation email.
  *
  * @param ActivityModel $activity
  */
 public function sendActivityCreationEmail(ActivityModel $activity)
 {
     $body = $this->render('email/activity', ['activity' => $activity]);
     $html = new MimePart($body);
     $html->type = "text/html";
     $mimeMessage = new MimeMessage();
     $mimeMessage->setParts([$html]);
     $message = new Message();
     $config = $this->getConfig();
     $message->addFrom($config['from']);
     $message->addTo($config['to']['activity_creation']);
     $message->setSubject('Nieuwe activiteit aangemaakt op de GEWIS website | New activity was created on the GEWIS website');
     $message->setBody($mimeMessage);
     $this->getTransport()->send($message);
 }
开发者ID:Mesoptier,项目名称:gewisweb,代码行数:20,代码来源:Email.php


注:本文中的Zend\Mail\Message::addFrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。