本文整理汇总了PHP中Mail::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail::__construct方法的具体用法?PHP Mail::__construct怎么用?PHP Mail::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mail
的用法示例。
在下文中一共展示了Mail::__construct方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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();
}
示例2:
/**
* 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'];
}
}
示例3: isset
/**
* 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();
}
示例4: __construct
/**
* 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);
}
}
}
示例5: strpos
/**
* 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";
}
}
示例6: join
/**
* 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";
}
}
示例7: __construct
/**
* 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);
}
}
}
示例8: __construct
public function __construct()
{
parent::__construct();
$this->setSubject(static::SUBJECT);
}
示例9:
/**
* 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']);
}
}