本文整理汇总了PHP中SMTP::Text方法的典型用法代码示例。如果您正苦于以下问题:PHP SMTP::Text方法的具体用法?PHP SMTP::Text怎么用?PHP SMTP::Text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMTP
的用法示例。
在下文中一共展示了SMTP::Text方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_email
function send_email($to_email, $to_name, $theme, $text_text, $text_html = '')
{
global $config;
if (!$config['smtp_adress']) {
output_message('alert', 'Set SMTP settings in config !');
return false;
}
if (!$to_email) {
output_message('alert', 'Field "to" is empty.');
return false;
}
set_time_limit(300);
require_once 'core/mail/smtp.php';
$mail = new SMTP();
$mail->Delivery('relay');
$mail->Relay($config['smtp_adress'], $config['smtp_username'], $config['smtp_password']);
$mail->From($config['site_email'], $config['base_href']);
$mail->AddTo($to_email, $to_name);
$mail->Text($text_text);
if ($text_html) {
$mail->Html($text_html);
}
$sent = $mail->Send($theme);
return $sent;
}
示例2: send_email
function send_email($to_email, $to_name, $theme, $text_text, $text_html = '')
{
global $MW;
if (!(string) $MW->getConfig->generic->smtp_adress) {
output_message('alert', 'Set SMTP settings in config !');
return false;
}
if (!$to_email) {
output_message('alert', 'Field "to" is empty.');
return false;
}
set_time_limit(300);
include 'core/mail/smtp.php';
$mail = new SMTP();
$mail->Delivery('relay');
$mail->Relay((string) $MW->getConfig->generic->smtp_adress, (string) $MW->getConfig->generic->smtp_username, (string) $MW->getConfig->generic->smtp_password);
$mail->From((string) $MW->getConfig->generic->site_email, (string) $MW->getConfig->generic->site_title);
$mail->AddTo($to_email, $to_name);
$mail->Text($text_text);
if ($text_html) {
$mail->Html($text_html);
}
$sent = $mail->Send($theme);
return $sent;
}