本文整理匯總了PHP中JMail::SetLanguage方法的典型用法代碼示例。如果您正苦於以下問題:PHP JMail::SetLanguage方法的具體用法?PHP JMail::SetLanguage怎麽用?PHP JMail::SetLanguage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JMail
的用法示例。
在下文中一共展示了JMail::SetLanguage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getMailer
/**
* This function is used to override the send function in Joomla
*/
public static function getMailer($mailing, $html = 0)
{
$fromname = empty($mailing->fromname) ? trim($GLOBALS[JNEWS . 'sendmail_name']) : trim($mailing->fromname);
$fromemail = empty($mailing->fromemail) ? trim($GLOBALS[JNEWS . 'sendmail_email']) : trim($mailing->fromemail);
$frombounce = empty($mailing->frombounce) ? trim($GLOBALS[JNEWS . 'sendmail_from']) : trim($mailing->frombounce);
if (empty($fromemail)) {
$my = JFactory::getUser();
$userSender = jNews_Subscribers::getUsers('gid', '50', $my->id);
$fromemail = $userSender[0]->email;
if (empty($fromemail)) {
jnews::printM('no', 'The sender email needs to be specified in the configuration.');
return false;
}
}
if (empty($frombounce)) {
$frombounce = $fromemail;
}
$attachments = $mailing->attachments;
$images = $mailing->images;
$conf = JFactory::getConfig();
$frombounceName = $fromname ? $fromname : $conf->get('config.fromname');
if (empty($fromemail)) {
$fromemail = trim($conf->get('config.mailfrom'));
}
if (empty($fromname)) {
$fromname = trim($conf->get('config.fromname'));
}
jimport('joomla.mail.mail');
$phpmailerPath = JPATH_LIBRARIES . DS . 'phpmailer' . DS;
$mail = new JMail();
$mail->PluginDir = $phpmailerPath;
$mail->SetLanguage('en', $phpmailerPath . 'language' . DS);
$mail->WordWrap = 150;
// $mail->addCustomHeader("X-Mailer: ".JNEWS_JPATH_LIVE);
// $mail->addCustomHeader("X-MessageID: $mailing->id");
if ($GLOBALS[JNEWS . 'mail_format'] == '1') {
$mail->Encoding = 'base64';
}
if ($GLOBALS[JNEWS . 'minisendmail']) {
$frombounceName = '';
}
if (!empty($frombounce)) {
if (version_compare(JVERSION, '3.0.0', '<')) {
$mail->addReplyTo(array($frombounce, $frombounceName));
} else {
$mail->addReplyTo(array($frombounce));
}
JRequest::setVar('bounceBackEmail', $frombounce);
}
$mail->From = trim($fromemail);
if ($GLOBALS[JNEWS . 'minisendmail']) {
$mail->FromName = '';
} else {
$mail->FromName = $fromname;
}
$mail->Sender = trim($GLOBALS[JNEWS . 'sendmail_from']);
if (empty($mail->Sender)) {
$mail->Sender = '';
}
switch ($GLOBALS[JNEWS . 'emailmethod']) {
case 'mail':
$mail->IsMail();
break;
case 'sendmail':
$mail->IsSendmail();
$mail->Sendmail = $GLOBALS[JNEWS . 'sendmail_path'] ? $GLOBALS[JNEWS . 'sendmail_path'] : $conf->get('config.sendmail');
break;
case 'smtp':
$mail->IsSMTP();
$mail->Host = $GLOBALS[JNEWS . 'smtp_host'] ? $GLOBALS[JNEWS . 'smtp_host'] : $conf->get('config.smtphost');
$mail->Port = $GLOBALS[JNEWS . 'smtp_port'] ? $GLOBALS[JNEWS . 'smtp_port'] : $conf->get('config.smtpport');
$mail->SMTPSecure = $GLOBALS[JNEWS . 'smtp_secure'] ? $GLOBALS[JNEWS . 'smtp_secure'] : '';
if ((bool) $GLOBALS[JNEWS . 'smtp_auth_required']) {
$mail->SMTPAuth = $GLOBALS[JNEWS . 'smtp_auth_required'];
$mail->Password = $GLOBALS[JNEWS . 'smtp_password'];
$mail->Username = $GLOBALS[JNEWS . 'smtp_username'];
}
break;
default:
$mail->Mailer = $conf->get('config.mailer');
break;
}
if (!empty($attachments)) {
foreach ($attachments as $attachment) {
if (basename($attachment) !== 'index.html') {
$mail->AddAttachment(JNEWS_JPATH_ROOT_NO_ADMIN . $GLOBALS[JNEWS . 'upload_url'] . DS . basename($attachment));
}
}
}
switch (substr(strtoupper(PHP_OS), 0, 3)) {
case "WIN":
$mail->LE = "\r\n";
break;
case "MAC":
case "DAR":
$mail->LE = "\r";
default:
//.........這裏部分代碼省略.........