本文整理匯總了PHP中Swift_Message::addTo方法的典型用法代碼示例。如果您正苦於以下問題:PHP Swift_Message::addTo方法的具體用法?PHP Swift_Message::addTo怎麽用?PHP Swift_Message::addTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Swift_Message
的用法示例。
在下文中一共展示了Swift_Message::addTo方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSend
public function testSend()
{
$message = new Swift_Message();
$message->setFrom('johnny5@example.com', 'Johnny #5');
$message->setSubject('Is alive!');
$message->addTo('you@example.com', 'A. Friend');
$message->addTo('you+two@example.com');
$message->addCc('another+1@example.com');
$message->addCc('another+2@example.com', 'Extra 2');
$message->addBcc('another+3@example.com');
$message->addBcc('another+4@example.com', 'Extra 4');
$message->addPart('<q>Help me Rhonda</q>', 'text/html');
$message->addPart('Doo-wah-ditty.', 'text/plain');
$attachment = Swift_Attachment::newInstance('This is the plain text attachment.', 'hello.txt', 'text/plain');
$attachment2 = Swift_Attachment::newInstance('This is the plain text attachment.', 'hello.txt', 'text/plain');
$attachment2->setDisposition('inline');
$message->attach($attachment);
$message->attach($attachment2);
$message->setPriority(1);
$headers = $message->getHeaders();
$headers->addTextHeader('X-PM-Tag', 'movie-quotes');
$messageId = $headers->get('Message-ID')->getId();
$transport = new PostmarkTransportStub('TESTING_SERVER');
$client = $this->getMock('GuzzleHttp\\Client', array('request'));
$transport->setHttpClient($client);
$o = PHP_OS;
$v = phpversion();
$client->expects($this->once())->method('request')->with($this->equalTo('POST'), $this->equalTo('https://api.postmarkapp.com/email'), $this->equalTo(['headers' => ['X-Postmark-Server-Token' => 'TESTING_SERVER', 'User-Agent' => "swiftmailer-postmark (PHP Version: {$v}, OS: {$o})", 'Content-Type' => 'application/json'], 'json' => ['From' => '"Johnny #5" <johnny5@example.com>', 'To' => '"A. Friend" <you@example.com>,you+two@example.com', 'Cc' => 'another+1@example.com,"Extra 2" <another+2@example.com>', 'Bcc' => 'another+3@example.com,"Extra 4" <another+4@example.com>', 'Subject' => 'Is alive!', 'Tag' => 'movie-quotes', 'TextBody' => 'Doo-wah-ditty.', 'HtmlBody' => '<q>Help me Rhonda</q>', 'Headers' => [['Name' => 'Message-ID', 'Value' => '<' . $messageId . '>'], ['Name' => 'X-PM-KeepID', 'Value' => 'true'], ['Name' => 'X-Priority', 'Value' => '1 (Highest)']], 'Attachments' => [['ContentType' => 'text/plain', 'Content' => 'VGhpcyBpcyB0aGUgcGxhaW4gdGV4dCBhdHRhY2htZW50Lg==', 'Name' => 'hello.txt'], ['ContentType' => 'text/plain', 'Content' => 'VGhpcyBpcyB0aGUgcGxhaW4gdGV4dCBhdHRhY2htZW50Lg==', 'Name' => 'hello.txt', 'ContentID' => 'cid:' . $attachment2->getId()]]]]));
$transport->send($message);
}
示例2: prepare
/**
* {@inheritdoc}
*/
public function prepare($from, $fromName, array $to, $subject, $body, array $attachments = array(), array $options = array())
{
$this->mail = \Swift_Message::newInstance()->setSubject($subject)->setFrom($from)->setBody($body, 'text/html');
foreach ($to as $receiver) {
$this->mail->addTo($receiver);
}
if (!empty($attachments)) {
foreach ($attachments as $attachment) {
$this->mail->attach(\Swift_Attachment::fromPath($attachment));
}
}
}
示例3: sendMessage
private function sendMessage(FollowUserEvent $event)
{
$templating = $this->containerAware->get('templating');
$message = new \Swift_Message("Vous avez une nouvel abonné!", $templating->render('SnoozitSkuagBundle:Mail/Follow:UserFollowed.html.twig', array('followerUserName' => $event->getUser()->getUsername())), 'text/html');
$message->addTo('gautierkris@gmail.com')->addFrom('gautierkris@gmail.com');
$this->mailer->send($message);
}
示例4: sendGuestMessage
private function sendGuestMessage(InterestEvent $event)
{
$templating = $this->containerAware->get('templating');
$message = new \Swift_Message("Désistement sur votre annonce!", $templating->render('SnoozitSkuagBundle:Mail/Interest:UnInterestedMail.html.twig', array('slug' => $event->getAdvertSlug(), 'id' => $event->getAdvertId(), 'title' => $event->getAdvertTitle(), 'userInterested' => $event->getCustomerUsername(), 'ownername' => $event->getGuestOwnerName())), 'text/html');
$message->addTo('gautierkris@gmail.com')->addFrom('gautierkris@gmail.com');
$this->mailer->send($message);
}
示例5: sendMessage
private function sendMessage(InterestEvent $event)
{
$templating = $this->containerAware->get('templating');
$message = new \Swift_Message("Vente réussie à modifier SoldSuccessListener", $templating->render('SnoozitSkuagBundle:Mail/Interest:InterestedMail.html.twig', array('slug' => $event->getAdvertSlug(), 'id' => $event->getAdvertId(), 'title' => $event->getAdvertTitle(), 'userInterested' => $event->getCustomerUsername(), 'ownername' => $event->getOwnerUsername())), 'text/html');
$message->addTo('gautierkris@gmail.com')->addFrom('gautierkris@gmail.com');
$this->mailer->send($message);
}
示例6: sendMessage
private function sendMessage(User $user)
{
$templating = $this->containerAware->get('templating');
$message = new \Swift_Message("Snoozit vous souhaite la bienvenue!", $templating->render('SnoozitSkuagBundle:Mail/Registration:RegistrationMail.html.twig', array('user' => $user->getUsername())), 'text/html');
$message->addTo('gautierkris@gmail.com')->addFrom('gautierkris@gmail.com');
$this->mailer->send($message);
}
示例7: fromWrappedMessage
/**
* @inheritDoc
*/
public static function fromWrappedMessage(MailWrappedMessage $wrappedMessage = null, $transport = null)
{
if (!$wrappedMessage instanceof MailWrappedMessage) {
throw new MailWrapperSetupException('Not MailWrappedMessage');
}
$message = new \Swift_Message();
foreach ($wrappedMessage->getToRecipients() as $address) {
$message->addTo($address);
}
foreach ($wrappedMessage->getCcRecipients() as $address) {
$message->addCc($address);
}
foreach ($wrappedMessage->getBccRecipients() as $address) {
$message->addBcc($address);
}
$message->setReplyTo($wrappedMessage->getReplyTo());
$message->setFrom($wrappedMessage->getFrom());
$message->setSubject($wrappedMessage->getSubject());
if ($wrappedMessage->getContentText()) {
$message->setBody($wrappedMessage->getContentText());
}
if ($wrappedMessage->getContentHtml()) {
$message->setBody($wrappedMessage->getContentHtml(), 'text/html');
}
return $message;
}
示例8: sendMessage
private function sendMessage(NegoceEvent $event)
{
$templating = $this->containerAware->get('templating');
$message = new \Swift_Message("Vous avez reçu une offre!", $templating->render('SnoozitSkuagBundle:Mail/Negoce:NegoceMail.html.twig', array('slug' => $event->getAdvertSlug(), 'id' => $event->getAdvertId(), 'title' => $event->getAdvertTitle(), 'userInterested' => $event->getCustomerUsername(), 'ownername' => $event->getOwnerUsername(), 'price' => $event->getPrice())), 'text/html');
$message->addTo('gautierkris@gmail.com')->addFrom('gautierkris@gmail.com');
$this->mailer->send($message);
}
示例9: createEmail
/**
* @param \FTC\Bundle\AuthBundle\Entity\User $recipient
* @param string $subject
* @param string $body
*
* @return \Swift_Message
*/
protected function createEmail($recipient, $subject, $body)
{
$email = new \Swift_Message();
$email->addTo($recipient->getEmail(), $recipient->getFullname());
$email->setFrom('notifications@fixthatcode.com', 'FixThatCode.com');
$email->setSubject($subject);
$email->setBody($body, 'text/html');
return $email;
}
示例10: createMessage
private function createMessage($body, $data, $config)
{
$message = new \Swift_Message();
$message->setFrom($config['from']['email']);
$message->setSubject($config['subject']);
$message->setBody($body);
$message->addTo($data->getEmail());
// $message->setSender($config['from']['name'])
return $message;
}
示例11: postPersist
public function postPersist(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
if (!$entity instanceof Application) {
return;
}
$message = new \Swift_Message('Nouvelle candidature', 'Vous avez reçu une nouvelle candidature');
$message->addTo($entity->getAuthor())->addFrom('vantruong.phan@ogpdc.fr');
$this->mailer->send($message);
}
示例12: postPersist
public function postPersist(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
if (!$entity instanceof Application) {
return;
}
$message = new \Swift_Message("Nouvelle candidature", "Vous avez reçu une nouvelle candidature !");
$message->addTo("noullez.nicolas@hotmail.fr")->addFrom("admin@monsite.com");
$this->mailer->send($message);
}
示例13: postPersist
public function postPersist(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
// On veut envoyer un email que pour les entités Application
if (!$entity instanceof Application) {
return;
}
$message = new \Swift_Message('Nouvelle candidature', 'Vous avez reçu une nouvelle candidature.');
$message->addTo($entity->getAdvert()->getAuthor());
$this->mailer->send($message);
}
示例14: action_send
/**
* This is just for the demo sending.
*/
public function action_send()
{
$message = new Swift_Message();
$message->addTo($this->request->post('to'));
$message->addFrom($this->request->post('from'));
$message->setSubject($this->request->post('subject'));
$message->setBody($this->request->post('message'));
$mq = new MailQueue();
$mq->add($message);
$this->redirect('mailqueue/demo');
}
示例15: sendMail
function sendMail($mail, $subject, $text)
{
$transport = \Swift_SendmailTransport::newInstance(env('MAIL_TRANSPORT') . ' -bs');
$swift = \Swift_Mailer::newInstance($transport);
$message = new \Swift_Message($subject);
$message->setFrom(env('MAIL_FROM'));
$message->setSender(env('MAIL_FROM'));
$message->setReplyTo(env('MAIL_FROM'));
$message->setBody($text, 'text/plain');
$message->addTo($mail);
$swift->send($message);
}