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


PHP Email::addCustomHeader方法代码示例

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


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

示例1: onAfterPostComment

 /**
  * Notify admin of new comment
  * 
  * @param Comment $comment
  */
 public function onAfterPostComment(Comment $comment)
 {
     // Determine recipient
     $recipient = CommentsNotifications::get_recipient($comment->getParent());
     if (empty($recipient)) {
         return;
     }
     // Check moderation status
     if (Config::inst()->get('CommentsNotifications', 'only_unmoderated') && $comment->Moderated) {
         return;
     }
     // Generate email
     $email = new Email();
     $email->setSubject(Config::inst()->get('CommentsNotifications', 'email_subject'));
     $email->setTo($recipient);
     $email->setTemplate(Config::inst()->get('CommentsNotifications', 'email_template'));
     $email->populateTemplate($comment);
     // Corretly set sender and from as per email convention
     $sender = Config::inst()->get('CommentsNotifications', 'email_sender');
     if (!empty($comment->Email)) {
         $email->setFrom($comment->Email);
         $email->addCustomHeader('Reply-To', $comment->Email);
     } else {
         $email->setFrom($sender);
     }
     $email->addCustomHeader('X-Sender', $sender);
     $email->addCustomHeader('Sender', $sender);
     $this->owner->extend('updateEmail', $email);
     // Send
     $email->send();
 }
开发者ID:helpfulrobot,项目名称:tractorcow-silverstripe-comments-notifications,代码行数:36,代码来源:CommentingControllerNotificationsExtension.php

示例2: createEmail

 public function createEmail($member)
 {
     //error_log("LOG MESSAGE FROM FORUM EMAIL POST DECORATOR LINK IS ".$this->owner->AbsoluteLink());
     $controller = new SubscribeController();
     $email = new Email();
     $from_email = $this->owner->Forum()->parent()->FromEmail;
     $email->setFrom($from_email);
     $reply_to = $this->owner->Forum()->parent()->ReplyTo;
     $email->addCustomHeader('Reply-To', $reply_to);
     $email->setTo($member->Email);
     $config = SiteConfig::current_site_config();
     $email->setSubject($this->owner->Title . ' | ' . $config->Title . ' ' . $this->owner->Forum()->Title . ' Forum');
     $email->setTemplate('Forum_SubscriberNotification');
     $email->populateTemplate(array('Recipient' => $member->FirstName, 'Link' => $this->owner->Link(), 'Title' => $this->owner->Title, 'Content' => $this->owner->Content, 'Author' => $this->owner->Author()->Nickname, 'Forum' => $this->owner->Forum()->Title, 'UnsubscribeLinkFromForum' => Director::absoluteBaseURL() . $controller->Link('unsubscribe/' . $this->owner->ForumID)));
     $email->send();
 }
开发者ID:liquidedge,项目名称:forum_subscribe,代码行数:16,代码来源:ForumPostEmailSubscribers.php

示例3: testSendHTML

 public function testSendHTML()
 {
     // Set custom $project - used in email headers
     global $project;
     $oldProject = $project;
     $project = 'emailtest';
     Email::set_mailer(new EmailTest_Mailer());
     $email = new Email('from@example.com', 'to@example.com', 'Test send plain', 'Testing Email->sendPlain()', null, 'cc@example.com', 'bcc@example.com');
     $email->attachFile(__DIR__ . '/fixtures/attachment.txt', null, 'text/plain');
     $email->addCustomHeader('foo', 'bar');
     $sent = $email->send(123);
     // Restore old project name after sending
     $project = $oldProject;
     $this->assertEquals('to@example.com', $sent['to']);
     $this->assertEquals('from@example.com', $sent['from']);
     $this->assertEquals('Test send plain', $sent['subject']);
     $this->assertContains('Testing Email->sendPlain()', $sent['content']);
     $this->assertNull($sent['plaincontent']);
     $this->assertEquals(array(0 => array('contents' => 'Hello, I\'m a text document.', 'filename' => 'attachment.txt', 'mimetype' => 'text/plain')), $sent['files']);
     $this->assertEquals(array('foo' => 'bar', 'X-SilverStripeMessageID' => 'emailtest.123', 'X-SilverStripeSite' => 'emailtest', 'Cc' => 'cc@example.com', 'Bcc' => 'bcc@example.com'), $sent['customheaders']);
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:21,代码来源:EmailTest.php

示例4: Email

<?php

require_once "lib/TurboApiClient.php";
$email = new Email();
$email->setFrom("aa@domain.com");
$email->setToList("bb.com, cc@domain.com");
$email->setCcList("dd@domain.com,ee@domain.com");
$email->setBccList("ffi@domain.com,rr@domain.com");
$email->setSubject("subject");
$email->setContent("content");
$email->setHtmlContent("html content");
$email->addCustomHeader('X-FirstHeader', "value");
$email->addCustomHeader('X-SecondHeader', "value");
$email->addCustomHeader('X-Header-da-rimuovere', 'value');
$email->removeCustomHeader('X-Header-da-rimuovere');
$turboApiClient = new TurboApiClient("_username", "_password");
$response = $turboApiClient->sendEmail($email);
var_dump($response);
开发者ID:hoangsoft90,项目名称:hack-google-ads-crx,代码行数:18,代码来源:sendapi_script.php

示例5: SendEnquiryForm

 public function SendEnquiryForm($data, $form)
 {
     $From = $this->EmailFrom;
     $To = $this->EmailTo;
     $Subject = $this->EmailSubject;
     $email = new Email($From, $To, $Subject);
     $replyTo = $this->EnquiryFormFields()->filter(array('FieldType' => 'Email'))->First();
     if ($replyTo) {
         $postField = $this->keyGen($replyTo->FieldName, $replyTo->SortOrder);
         if (isset($data[$postField]) && Email::validEmailAddress($data[$postField])) {
             $email->replyTo($data[$postField]);
         }
     }
     if ($this->EmailBcc) {
         $email->setBcc($this->EmailBcc);
     }
     //abuse / tracking
     $email->addCustomHeader('X-Sender-IP', $_SERVER['REMOTE_ADDR']);
     //set template
     $email->setTemplate('EnquiryFormEmail');
     //populate template
     $templateData = $this->getTemplateData($data);
     $email->populateTemplate($templateData);
     //send mail
     $email->send();
     //return to submitted message
     if (Director::is_ajax()) {
         return $this->renderWith('EnquiryPageAjaxSuccess');
     }
     $this->redirect($this->Link('?success=1#thankyou'));
 }
开发者ID:axllent,项目名称:silverstripe-enquiry-page,代码行数:31,代码来源:EnquiryPage.php

示例6: Email

<?php

require_once "/var/www/TurboApiClient.php";
$email1 = $email;
// creation of the email to be sent
$email = new Email();
$email->setFrom("mail@bitjini.com");
$email->setToList($email1);
//$email->setCcList("mary.davies@domain.com, mary.smith@domain.com");
//$email->setBccList("maria.campbell@domain.com, don.smith@domain.com");
$email->setSubject("subject");
$email->setContent("content");
$email->setHtmlContent("Your token is : " . $token);
$email->addCustomHeader('X-FirstHeader', "value");
$email->addCustomHeader('X-SecondHeader', "value");
$email->addCustomHeader('X-Header-to-be-removed', 'value');
$email->removeCustomHeader('X-Header-to-be-removed');
// creation of a client that connects with turbo-smtp APIs
$turboApiClient = new TurboApiClient("girish@bitjini.com", "Wa7mS3us");
// email sending
$response = $turboApiClient->sendEmail($email);
// display of the operations outcome
//var_dump($response);
开发者ID:poojapauskar,项目名称:kLink,代码行数:23,代码来源:mail.php


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