public function __construct($to, $from, $reply_to, $subject, $body) { // call default constructor parent::__construct($to, $from, $reply_to, $subject, $body); // set different header with HTML information $this->update_header(); }
/** * Constructor. * * Instantiates a new Mail_mock:: object based on the parameters * passed in. It looks for the following parameters, both optional: * preSendCallback Called before an email would be sent. * postSendCallback Called after an email would have been sent. * * @param array Hash containing any parameters. * @access public */ function __construct($params) { parent::__construct(); if (isset($params['preSendCallback']) && is_callable($params['preSendCallback'])) { $this->_preSendCallback = $params['preSendCallback']; } if (isset($params['postSendCallback']) && is_callable($params['postSendCallback'])) { $this->_postSendCallback = $params['postSendCallback']; } }
/** * Constructor. * @param $emailKey string unique identifier for the template * @param $locale string locale of the template * @param $includeSignature boolean optional */ function __construct($emailKey = null, $locale = null, $context = null, $includeSignature = true) { parent::__construct(); $this->emailKey = isset($emailKey) ? $emailKey : null; // If a context wasn't specified, use the current request. $application = PKPApplication::getApplication(); $request = $application->getRequest(); if ($context === null) { $context = $request->getContext(); } $this->includeSignature = $includeSignature; // Use current user's locale if none specified $this->locale = isset($locale) ? $locale : AppLocale::getLocale(); // Record whether or not to BCC the sender when sending message $this->bccSender = $request->getUserVar('bccSender'); $this->addressFieldsEnabled = true; if (isset($this->emailKey)) { $emailTemplateDao = DAORegistry::getDAO('EmailTemplateDAO'); $emailTemplate = $emailTemplateDao->getEmailTemplate($this->emailKey, $this->locale, $context == null ? 0 : $context->getId()); } $userSig = ''; $user = defined('SESSION_DISABLE_INIT') ? null : $request->getUser(); if ($user && $this->includeSignature) { $userSig = $user->getLocalizedSignature(); if (!empty($userSig)) { $userSig = "<br/>" . $userSig; } } if (isset($emailTemplate)) { $this->setSubject($emailTemplate->getSubject()); $this->setBody($emailTemplate->getBody() . $userSig); $this->enabled = $emailTemplate->getEnabled(); } else { $this->setBody($userSig); $this->enabled = true; } // Default "From" to user if available, otherwise site/context principal contact $this->emailHeader = ''; if ($user) { $this->setFrom($user->getEmail(), $user->getFullName()); } elseif (is_null($context) || is_null($context->getSetting('contactEmail'))) { $site = $request->getSite(); $this->setFrom($site->getLocalizedContactEmail(), $site->getLocalizedContactName()); } else { $this->setFrom($context->getSetting('contactEmail'), $context->getSetting('contactName')); $this->emailHeader = $context->getSetting('emailHeader'); } if ($context) { $this->setSubject('[' . $context->getLocalizedAcronym() . '] ' . $this->getSubject()); } $this->context = $context; $this->params = array(); }
/** * Constructor * * @param mixed $content Lang instance or subject as string */ public function __construct($content = 'No subject') { $use_html = Config::get('email_use_html'); // Cast content to string if translation object $subject = $content instanceof Translation ? (string) $content->subject : $content; // Trigger basic mail build parent::__construct(null, $subject, $use_html); // Write content if a translation object was given if ($content instanceof Translation) { $this->writePlain($content->plain); if ($use_html) { $this->writeHTML($content->html); } } }
/** * Constructor. * * Instantiates a new Mail_sendmail:: object based on the parameters * passed in. It looks for the following parameters: * sendmail_path The location of the sendmail binary on the * filesystem. Defaults to '/usr/sbin/sendmail'. * * sendmail_args Any extra parameters to pass to the sendmail * or sendmail wrapper binary. * * If a parameter is present in the $params array, it replaces the * default. * * @param array $params Hash containing any parameters different from the * defaults. * @access public */ function __construct($params) { parent::__construct(); if (isset($params['sendmail_path'])) { $this->sendmail_path = $params['sendmail_path']; } if (isset($params['sendmail_args'])) { $this->sendmail_args = $params['sendmail_args']; } /* * Because we need to pass message headers to the sendmail program on * the commandline, we can't guarantee the use of the standard "\r\n" * separator. Instead, we use the system's native line separator. */ if (defined('PHP_EOL')) { $this->sep = PHP_EOL; } else { $this->sep = strpos(PHP_OS, 'WIN') === false ? "\n" : "\r\n"; } }
/** * Constructor. * * Instantiates a new Mail_mail:: object based on the parameters * passed in. * * @param array $params Extra arguments for the mail() function. */ function __construct($params = null) { parent::__construct(); // The other mail implementations accept parameters as arrays. // In the interest of being consistent, explode an array into // a string of parameter arguments. if (is_array($params)) { $this->_params = join(' ', $params); } else { $this->_params = $params; } /* Because the mail() function may pass headers as command * line arguments, we can't guarantee the use of the standard * "\r\n" separator. Instead, we use the system's native line * separator. */ if (defined('PHP_EOL')) { $this->sep = PHP_EOL; } else { $this->sep = strpos(PHP_OS, 'WIN') === false ? "\n" : "\r\n"; } }
/** * Constructor * * @param mixed $content Lang instance or subject as string */ public function __construct($content = 'No subject') { $use_html = Config::get('email_use_html'); // Cast content to string if translation object $subject = $content instanceof Translation ? $content->subject : $content; if ($subject instanceof Translation) { $subject = $subject->out(); } if (is_array($subject)) { $subject = array_filter($subject); $subject = $subject['prefix'] . ' ' . array_pop($subject); } // Trigger basic mail build parent::__construct(null, $subject, $use_html); // Write content if a translation object was given if ($content instanceof Translation) { $this->writePlain($content->plain); if ($use_html) { $this->writeHTML($content->html); } } }
public function __construct() { parent::__construct(); $this->setSubject(static::SUBJECT); }
/** * Constructor. * * Instantiates a new Mail_smtp:: object based on the parameters * passed in. It looks for the following parameters: * host The server to connect to. Defaults to localhost. * port The port to connect to. Defaults to 25. * auth SMTP authentication. Defaults to none. * username The username to use for SMTP auth. No default. * password The password to use for SMTP auth. No default. * localhost The local hostname / domain. Defaults to localhost. * timeout The SMTP connection timeout. Defaults to none. * verp Whether to use VERP or not. Defaults to false. * DEPRECATED as of 1.2.0 (use setMailParams()). * debug Activate SMTP debug mode? Defaults to false. * persist Should the SMTP connection persist? * pipelining Use SMTP command pipelining * * If a parameter is present in the $params array, it replaces the * default. * * @param array Hash containing any parameters different from the * defaults. * @access public */ function __construct($params) { parent::__construct(); if (isset($params['host'])) { $this->host = $params['host']; } if (isset($params['port'])) { $this->port = $params['port']; } if (isset($params['auth'])) { $this->auth = $params['auth']; } if (isset($params['username'])) { $this->username = $params['username']; } if (isset($params['password'])) { $this->password = $params['password']; } if (isset($params['localhost'])) { $this->localhost = $params['localhost']; } if (isset($params['timeout'])) { $this->timeout = $params['timeout']; } if (isset($params['debug'])) { $this->debug = (bool) $params['debug']; } if (isset($params['persist'])) { $this->persist = (bool) $params['persist']; } if (isset($params['pipelining'])) { $this->pipelining = (bool) $params['pipelining']; } // Deprecated options if (isset($params['verp'])) { $this->addServiceExtensionParameter('XVERP', is_bool($params['verp']) ? null : $params['verp']); } }