本文整理汇总了PHP中Email::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Email::__construct方法的具体用法?PHP Email::__construct怎么用?PHP Email::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Email
的用法示例。
在下文中一共展示了Email::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(array $options = null)
{
if (!is_array($options)) {
$options = [];
}
if (empty($options["smtpServer"])) {
$hostname = "localhost";
} else {
$hostname = $options["smtpServer"];
}
if ($hostname === "localhost") {
$port = isset($options["local-port"]) ? $options["local-port"] : 25;
} else {
$port = isset($options["port"]) ? $options["port"] : 465;
}
$server = new Server($hostname, $port);
if (!empty($options["username"]) || !empty($options["password"])) {
$server->setCredentials($options["username"], $options["password"]);
}
if (!empty($options["encryption"])) {
$server->setEncryptionMethod($options["encryption"]);
}
if (!empty($options["returnPath"])) {
$server->setReturnPath($options["returnPath"]);
}
parent::__construct($server);
if (!empty($options["fromAddress"])) {
$this->setFromAddress($options["fromAddress"], $options["fromName"]);
}
}
示例2: __construct
public function __construct($fromEmail, $message, $name = null, array $headers = [])
{
// If there's a name, add it to the subject
if ($name) {
$subject = $this->subject . ' from ' . $name;
}
parent::__construct($this->to, $fromEmail, $message, $subject);
}
示例3: __construct
/**
* @param MemberProfilePage $page
* @param Member $member
*/
public function __construct($page, $member)
{
$from = $page->EmailFrom ? $page->EmailFrom : Email::getAdminEmail();
$to = $member->Email;
$subject = self::get_parsed_string($page->ApprovalEmailSubject, $member, $page);
$body = self::get_parsed_string($page->ApprovalEmailTemplate, $member, $page);
parent::__construct($from, $to, $subject, $body);
}
示例4: __construct
public function __construct($page, $member, $offers)
{
$from = $page->EmailFrom;
$to = $member->Email;
$subject = $page->NewOffersNewsletterSubject;
parent::__construct($from, $to, $subject);
$this->populateTemplate(new ArrayData(array('Member' => $member, 'TaskPage' => $page, 'Offers' => $offers, '$SiteName' => SiteConfig::current_site_config()->Title, '$LoginLink' => Director::absoluteURL(singleton('Security')->Link('login')))));
}
示例5: ArrayData
/**
* @param Newsletter $newsletter
* @param NewsletterType $type
*/
function __construct($newsletter, $type = null)
{
$this->newsletter = $newsletter;
$this->nlType = $type ? $type : $newsletter->getNewsletterType();
parent::__construct();
$this->body = $newsletter->getContentBody();
$this->populateTemplate(new ArrayData(array('Newsletter' => $this->Newsletter, 'UnsubscribeLink' => $this->UnsubscribeLink())));
$this->extend('updateNewsletterEmail', $this);
}
示例6: ArrayData
/**
* @param Newsletter $newsletter
* @param Mailinglists $recipient
* @param Boolean $fakeRecipient
*/
function __construct($newsletter, $recipient, $fakeRecipient = false)
{
$this->newsletter = $newsletter;
$this->mailinglists = $newsletter->MailingLists();
$this->recipient = $recipient;
$this->fakeRecipient = $fakeRecipient;
parent::__construct($this->newsletter->SendFrom, $this->recipient->Email);
$this->populateTemplate(new ArrayData(array('UnsubscribeLink' => $this->UnsubscribeLink(), 'SiteConfig' => DataObject::get_one('SiteConfig'), 'AbsoluteBaseURL' => Director::absoluteBaseURLWithAuth())));
$this->body = $newsletter->getContentBody();
$this->subject = $newsletter->Subject;
$this->ss_template = $newsletter->RenderTemplate;
if ($this->body && $this->newsletter) {
$text = $this->body->forTemplate();
//Recipient Fields ShortCode parsing
$bodyViewer = new SSViewer_FromString($text);
$text = $bodyViewer->process($this->templateData());
// Install link tracking by replacing existing links with "newsletterlink" and hash-based reference.
if ($this->config()->link_tracking_enabled && !$this->fakeRecipient && preg_match_all("/<a\\s[^>]*href=\"([^\"]*)\"[^>]*>(.*)<\\/a>/siU", $text, $matches)) {
if (isset($matches[1]) && ($links = $matches[1])) {
$titles = isset($matches[2]) ? $matches[2] : array();
$id = (int) $this->newsletter->ID;
$replacements = array();
$current = array();
// workaround as we want to match the longest urls (/foo/bar/baz) before /foo/
array_unique($links);
$sorted = array_combine($links, array_map('strlen', $links));
arsort($sorted);
foreach ($sorted as $link => $length) {
$SQL_link = Convert::raw2sql($link);
$tracked = DataObject::get_one('Newsletter_TrackedLink', "\"NewsletterID\" = '" . $id . "' AND \"Original\" = '" . $SQL_link . "'");
if (!$tracked) {
// make one.
$tracked = new Newsletter_TrackedLink();
$tracked->Original = $link;
$tracked->NewsletterID = $id;
$tracked->write();
}
// replace the link
$replacements[$link] = $tracked->Link();
// track that this link is still active
$current[] = $tracked->ID;
}
// replace the strings
$text = str_ireplace(array_keys($replacements), array_values($replacements), $text);
}
}
// replace the body
$output = new HTMLText();
$output->setValue($text);
$this->body = $output;
}
}
示例7: __construct
public function __construct($member = null)
{
$member = $member ? $member : Member::currentUser();
$link = Director::absoluteBaseUrl();
$host = parse_url($link, PHP_URL_HOST);
$this->subject = _t('WelcomeEmail.SUBJECT', "Welcome to {Website}", 'Email subject', ['Website' => SiteConfig::current_site_config()->Title]);
if ($member) {
$this->to = $member->Email;
if ($member->FirstName) {
$name = trim($member->FirstName . ' ' . $member->Surname);
$this->to = $name . ' <' . $member->Email . '>';
}
}
parent::__construct();
$this->populateTemplate(new ArrayData(['Member' => $member, 'AbsoluteWebsiteLink' => $link, 'WebsiteLink' => $host]));
}
示例8: __construct
public function __construct($content)
{
//Email is not set as on - none shall pass...
if (!$this->config()->enable_email) {
return;
}
//Check for a to and throw error if none set.
if (!$this->config()->email_to) {
user_error("You have not set an 'email_to' in the config", E_USER_ERROR);
return;
}
$from = Config::inst()->get('Email', 'admin_email');
$to = $this->config()->email_to;
$subject = "Suspected spammer: Please review";
parent::__construct($from, $to, $subject);
$this->populateTemplate(new ArrayData(array('Content' => $content)));
}
示例9: __construct
public function __construct($from = null, $to = null, $subject = null, $body = null, $bounceHandlerURL = null, $cc = null, $bcc = null)
{
parent::__construct($from, $to, $subject, $body, $bounceHandlerURL, $cc, $bcc);
// Use config template
if ($defaultTemplate = self::config()->default_template) {
$this->setTemplate($defaultTemplate);
}
// Allow subclass template
$class = get_called_class();
if ($class != 'MandrillEmail') {
$this->ss_template = array('email/' . $class, $this->ss_template);
}
// Allow user configurable theming
$config = SiteConfig::current_site_config();
if ($config->EmailTheme) {
$this->setTheme($config->EmailTheme);
} elseif ($theme = self::config()->default_theme) {
$this->setTheme($theme);
}
}
示例10:
function __construct()
{
parent::__construct();
$this->subject = _t('Member.SUBJECTPASSWORDRESET', "Your password reset link", PR_MEDIUM, 'Email subject');
}
示例11: __construct
/**
* __construct
*
* @param \Never5\LicenseWP\License\License $license
* @param string $first_name
*/
public function __construct($license, $first_name)
{
$subject = sprintf('Your %s license keys', get_bloginfo('name'));
parent::__construct($subject, 'new-license-email.php', array('license' => $license, 'user_first_name' => $first_name, 'email_heading' => $subject));
}
示例12:
function __construct() {
parent::__construct();
}
示例13: __construct
public function __construct($submittedFields = null)
{
parent::__construct($submittedFields = null);
}
示例14: __construct
/**
* Constructor
* @param object $db
*/
public function __construct(&$db)
{
$this->db =& $db;
$this->smTextObject = new TableText($this->db);
parent::__construct();
}
示例15: __construct
public function __construct($from = null, $to = null, $subject = null, $body = null, $bounceHandlerURL = null, $cc = null, $bcc = null)
{
parent::__construct($from, $to, $subject, $body, $bounceHandlerURL, $cc, $bcc);
user_error('Email_Template is deprecated. Please use Email instead.', E_USER_NOTICE);
}