本文整理匯總了PHP中JMail::useSMTP方法的典型用法代碼示例。如果您正苦於以下問題:PHP JMail::useSMTP方法的具體用法?PHP JMail::useSMTP怎麽用?PHP JMail::useSMTP使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JMail
的用法示例。
在下文中一共展示了JMail::useSMTP方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getMailer
function getMailer()
{
if (!FSS_Settings::Get('email_send_override')) {
$mailer = JFactory::getMailer();
$mailer->setSender($this->Get_Sender());
$mailer->CharSet = 'UTF-8';
return $mailer;
}
$smtpauth = FSS_Settings::Get('email_send_smtp_auth') == 0 ? null : 1;
$smtpuser = FSS_Settings::Get('email_send_smtp_username');
// $conf->get('smtpuser');
$smtppass = FSS_Settings::Get('email_send_smtp_password');
// $conf->get('smtppass');
$smtphost = FSS_Settings::Get('email_send_smtp_host');
// $conf->get('smtphost');
$smtpsecure = FSS_Settings::Get('email_send_smtp_security');
// $conf->get('smtpsecure');
$smtpport = FSS_Settings::Get('email_send_smtp_port');
// $conf->get('smtpport');
$mailfrom = FSS_Settings::Get('email_send_from_email');
// $conf->get('mailfrom');
$fromname = FSS_Settings::Get('email_send_from_name');
// $conf->get('fromname');
$mailer = FSS_Settings::Get('email_send_mailer');
// $conf->get('mailer');
// Create a JMail object
$mail = new JMail();
// Set default sender without Reply-to
$mail->SetFrom(JMailHelper::cleanLine($mailfrom), JMailHelper::cleanLine($fromname), 0);
// Default mailer is to use PHP's mail function
switch ($mailer) {
case 'smtp':
$mail->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
break;
case 'sendmail':
$mail->IsSendmail();
break;
default:
$mail->IsMail();
break;
}
$mail->CharSet = 'UTF-8';
return $mail;
}