本文整理汇总了PHP中PHPMailer::SetLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::SetLanguage方法的具体用法?PHP PHPMailer::SetLanguage怎么用?PHP PHPMailer::SetLanguage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPMailer
的用法示例。
在下文中一共展示了PHPMailer::SetLanguage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendNotify
function SendNotify($Rcpts = array(), $Subject = "", $Body = "")
{
require_once agEGW_APPLICATION_PATH . '/phpgwapi/inc/class.phpmailer.inc.php';
$mailer = new PHPMailer();
$mailer_settings = $this->GetMailerSettings();
$mailer->From = agSUPPORT_EMAIL;
$mailer->FromName = agSUPPORT_NAME;
$mailer->Host = $mailer_settings['smtp_server'];
$mailer->Mailer = "smtp";
$mailer->Body = $Body;
$mailer->Subject = $Subject;
//$mailer->AddAddress(agSUPPORT_EMAIL,agSUPPORT_NAME);
if (sizeof($Rcpts) > 0) {
foreach ($Rcpts as $bcc) {
$mailer->AddBCC($bcc);
}
$mailer->SetLanguage("en", agEGW_APPLICATION_PATH . '/phpgwapi/setup/');
if (!$mailer->Send()) {
// echo "<!--There has been a mail error sending: \n".$mailer->ErrorInfo."-->";
return False;
}
$mailer->ClearAddresses();
$mailer->ClearAttachments();
}
return True;
}
示例2: sendemail
function sendemail($toname, $toemail, $fromname, $fromemail, $subject, $message, $type = "plain", $cc = "", $bcc = "")
{
global $settings, $locale;
require_once INCLUDES . "class.phpmailer.php";
$mail = new PHPMailer();
if (file_exists(INCLUDES . "language/phpmailer.lang-" . $locale['phpmailer'] . ".php")) {
$mail->SetLanguage($locale['phpmailer'], INCLUDES . "language/");
} else {
$mail->SetLanguage("en", INCLUDES . "language/");
}
if (!$settings['smtp_host']) {
$mail->IsMAIL();
} else {
$mail->IsSMTP();
$mail->Host = $settings['smtp_host'];
$mail->Port = $settings['smtp_port'];
$mail->SMTPAuth = $settings['smtp_auth'] ? true : false;
$mail->Username = $settings['smtp_username'];
$mail->Password = $settings['smtp_password'];
}
$mail->CharSet = $locale['charset'];
$mail->From = $fromemail;
$mail->FromName = $fromname;
$mail->AddAddress($toemail, $toname);
$mail->AddReplyTo($fromemail, $fromname);
if ($cc) {
$cc = explode(", ", $cc);
foreach ($cc as $ccaddress) {
$mail->AddCC($ccaddress);
}
}
if ($bcc) {
$bcc = explode(", ", $bcc);
foreach ($bcc as $bccaddress) {
$mail->AddBCC($bccaddress);
}
}
if ($type == "plain") {
$mail->IsHTML(false);
} else {
$mail->IsHTML(true);
}
$mail->Subject = $subject;
$mail->Body = $message;
if (!$mail->Send()) {
$mail->ErrorInfo;
$mail->ClearAllRecipients();
$mail->ClearReplyTos();
return false;
} else {
$mail->ClearAllRecipients();
$mail->ClearReplyTos();
return true;
}
}
示例3: PHPlistMailer
function PHPlistMailer($messageid, $email)
{
# parent::PHPMailer();
parent::SetLanguage('en', dirname(__FILE__) . '/phpmailer/language/');
$this->addCustomHeader("X-Mailer: phplist v" . VERSION);
$this->addCustomHeader("X-MessageID: {$messageid}");
$this->addCustomHeader("X-ListMember: {$email}");
# $this->addCustomHeader("Precedence: bulk"); #http://mantis.phplist.com/view.php?id=15562
$this->CharSet = getConfig("html_charset");
if (defined('PHPMAILERHOST') && PHPMAILERHOST != '') {
//logEvent('Sending email via '.PHPMAILERHOST);
$this->SMTPAuth = true;
$this->Helo = getConfig("website");
$this->Host = PHPMAILERHOST;
if (isset($GLOBALS['phpmailer_smtpuser']) && $GLOBALS['phpmailer_smtpuser'] != '' && isset($GLOBALS['phpmailer_smtppassword']) && $GLOBALS['phpmailer_smtppassword']) {
$this->Username = $GLOBALS['phpmailer_smtpuser'];
$this->Password = $GLOBALS['phpmailer_smtppassword'];
}
$this->Mailer = "smtp";
} else {
# logEvent('Sending via mail');
$this->Mailer = "mail";
}
//$ip = gethostbyname($this->Host);
if ($GLOBALS["message_envelope"]) {
$this->Sender = $GLOBALS["message_envelope"];
$this->addCustomHeader("Errors-To: " . $GLOBALS["message_envelope"]);
}
}
示例4: PHPlistMailer
function PHPlistMailer($messageid, $email)
{
# parent::PHPMailer();
parent::SetLanguage('en', 'phpmailer/language/');
$this->addCustomHeader("X-Mailer: phplist v" . VERSION);
$this->addCustomHeader("X-MessageID: {$messageid}");
$this->addCustomHeader("X-ListMember: {$email}");
$this->addCustomHeader("Precedence: bulk");
$this->Host = PHPMAILERHOST;
$this->Helo = getConfig("website");
$this->CharSet = getConfig("html_charset");
if (isset($GLOBALS['phpmailer_smtpuser']) && $GLOBALS['phpmailer_smtpuser'] != '') {
$this->SMTPAuth = true;
$this->Username = $GLOBALS['phpmailer_smtpuser'];
$this->Password = $GLOBALS['phpmailer_smtppassword'];
# logEvent('Sending authenticated email via '.PHPMAILERHOST);
}
$ip = gethostbyname($this->Host);
if ($GLOBALS["message_envelope"]) {
$this->Sender = $GLOBALS["message_envelope"];
$this->addCustomHeader("Errors-To: " . $GLOBALS["message_envelope"]);
}
if (!$this->Host || $ip == $this->Host) {
$this->Mailer = "mail";
# logEvent('Sending via mail');
} else {
$this->Mailer = "smtp";
# logEvent('Sending via smtp');
}
}
示例5: foreach
/**
* Test language files for missing and excess translations
* All languages are compared with English
*/
function test_Translations()
{
$this->Mail->SetLanguage('en');
$definedStrings = $this->Mail->GetTranslations();
$err = '';
foreach (new DirectoryIterator('../language') as $fileInfo) {
if ($fileInfo->isDot()) {
continue;
}
$matches = array();
//Only look at language files, ignore anything else in there
if (preg_match('/^phpmailer\\.lang-([a-z_]{2,})\\.php$/', $fileInfo->getFilename(), $matches)) {
$lang = $matches[1];
//Extract language code
$PHPMAILER_LANG = array();
//Language strings get put in here
include $fileInfo->getPathname();
//Get language strings
$missing = array_diff(array_keys($definedStrings), array_keys($PHPMAILER_LANG));
$extra = array_diff(array_keys($PHPMAILER_LANG), array_keys($definedStrings));
if (!empty($missing)) {
$err .= "\nMissing translations in {$lang}: " . implode(', ', $missing);
}
if (!empty($extra)) {
$err .= "\nExtra translations in {$lang}: " . implode(', ', $extra);
}
}
}
$this->assertEmpty($err, $err);
}
示例6: sendEmail
function sendEmail($senderName, $senderEmail, $name, $email, $subject, $message)
{
include_once ROOT . "/library/contrib/phpmailer/class.phpmailer.php";
$mail = new PHPMailer();
$mail->SetLanguage('en', ROOT . "/library/contrib/phpmailer/language/");
$mail->IsHTML(true);
$mail->CharSet = 'utf-8';
$mail->From = $senderEmail;
$mail->FromName = $senderName;
$mail->Subject = $subject;
$mail->Body = $message;
$mail->AltBody = 'To view this email message, open the email with html enabled mailer.';
$mail->AddAddress($email, $name);
if (!Setting::getServiceSettingGlobal('useCustomSMTP', 0)) {
$mail->IsMail();
} else {
$mail->IsSMTP();
$mail->Host = Setting::getServiceSettingGlobal('smtpHost', '127.0.0.1');
$mail->Port = Setting::getServiceSettingGlobal('smtpPort', 25);
}
ob_start();
$ret = $mail->Send();
ob_clean();
if (!$ret) {
return array(false, $mail->ErrorInfo);
}
return true;
}
示例7: initMailFromSet
/**
* Inner mailer initialization from set variables
*
* @return void
*/
protected function initMailFromSet()
{
$this->mail->SetLanguage($this->get('langLocale'), $this->get('langPath'));
$this->mail->CharSet = $this->get('charset');
$this->mail->From = $this->get('from');
$this->mail->FromName = $this->get('from');
$this->mail->Sender = $this->get('from');
$this->mail->ClearAllRecipients();
$this->mail->ClearAttachments();
$this->mail->ClearCustomHeaders();
$emails = explode(static::MAIL_SEPARATOR, $this->get('to'));
foreach ($emails as $email) {
$this->mail->AddAddress($email);
}
$this->mail->Subject = $this->get('subject');
$this->mail->AltBody = $this->createAltBody($this->get('body'));
$this->mail->Body = $this->get('body');
// add custom headers
foreach ($this->get('customHeaders') as $header) {
$this->mail->AddCustomHeader($header);
}
if (is_array($this->get('images'))) {
foreach ($this->get('images') as $image) {
// Append to $attachment array
$this->mail->AddEmbeddedImage($image['path'], $image['name'] . '@mail.lc', $image['name'], 'base64', $image['mime']);
}
}
}
示例8: correoSMTP
function correoSMTP($para, $asunto, $mensaje, $html = true)
{
require_once 'php/class.phpmailer.php';
$Mail = new PHPMailer();
$Mail->IsHTML($html);
$Mail->SetLanguage("es", 'php/language/');
$Mail->PluginDir = 'php/';
$Mail->Mailer = 'smtp';
$Mail->Host = "smtp.gmail.com";
$Mail->SMTPSecure = "ssl";
$Mail->Port = 465;
$Mail->SMTPAuth = true;
$Mail->Username = "info@ufsonline.net";
$Mail->Password = "22436017";
$Mail->CharSet = "utf-8";
$Mail->Encoding = "quoted-printable";
$Mail->FromName = PROY_MAIL_POSTMASTER_NOMBRE . PROY_MAIL_POSTMASTER;
$Mail->Subject = $asunto;
$Mail->Body = $mensaje;
$Mail->AddAddress($para);
$x = $Mail->Send();
if ($x) {
return $x;
} else {
return correo($para, $asunto, $mensaje);
}
}
示例9:
/**
* Miscellaneous calls to improve test coverage and some small tests
*/
function test_Miscellaneous()
{
$this->assertEquals('application/pdf', PHPMailer::_mime_types('pdf'), 'MIME TYPE lookup failed');
$this->Mail->AddCustomHeader('SomeHeader: Some Value');
$this->Mail->ClearCustomHeaders();
$this->Mail->ClearAttachments();
$this->Mail->IsHTML(false);
$this->Mail->IsSMTP();
$this->Mail->IsMail();
$this->Mail->IsSendMail();
$this->Mail->IsQmail();
$this->Mail->SetLanguage('fr');
$this->Mail->Sender = '';
$this->Mail->CreateHeader();
$this->assertFalse($this->Mail->set('x', 'y'), 'Invalid property set succeeded');
$this->assertTrue($this->Mail->set('Timeout', 11), 'Valid property set failed');
//Test pathinfo
$a = '/mnt/files/飛兒樂 團光茫.mp3';
$q = PHPMailer::mb_pathinfo($a);
$this->assertEquals($q['dirname'], '/mnt/files', 'UNIX dirname not matched');
$this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'UNIX basename not matched');
$this->assertEquals($q['extension'], 'mp3', 'UNIX extension not matched');
$this->assertEquals($q['filename'], '飛兒樂 團光茫', 'UNIX filename not matched');
$this->assertEquals(PHPMailer::mb_pathinfo($a, PATHINFO_DIRNAME), '/mnt/files', 'Dirname path element not matched');
$this->assertEquals(PHPMailer::mb_pathinfo($a, 'filename'), '飛兒樂 團光茫', 'Filename path element not matched');
$a = 'c:\\mnt\\files\\飛兒樂 團光茫.mp3';
$q = PHPMailer::mb_pathinfo($a);
$this->assertEquals($q['dirname'], 'c:\\mnt\\files', 'Windows dirname not matched');
$this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'Windows basename not matched');
$this->assertEquals($q['extension'], 'mp3', 'Windows extension not matched');
$this->assertEquals($q['filename'], '飛兒樂 團光茫', 'Windows filename not matched');
}
示例10: SetLanguage
function SetLanguage($lang_type, $lang_path = null)
{
global $REX;
if ($lang_path == null) {
$lang_path = $REX['INCLUDE_PATH'] . '/addons/phpmailer/classes/language/';
}
parent::SetLanguage($lang_type, $lang_path);
}
示例11: sendMail
function sendMail()
{
$cfg = new ini();
$cfg->setFileName('./include/config/account.ini');
$cfg->load();
$user_mail = $cfg->getElementByValue('user', 'email');
$mail = new PHPMailer();
$mail->IsSMTP();
//$mail->SMTPDebug= 2;
//konfiguracja serwera
$mail->PluginDir = "phpmailer/";
$mail->Mailer = "smtp";
$mail->Host = $cfg->getElementByValue('server-config', 'Host');
$mail->SMTPSecure = $cfg->getElementByValue('server-config', 'SMTPSecure');
$mail->Port = $cfg->getElementByValue('server-config', 'Port');
//
$mail->SMTPKeepAlive = true;
$mail->SMTPAuth = true;
$mail->Username = $cfg->getElementByValue('server-config', 'Login');
$mail->Password = $cfg->getElementByValue('server-config', 'Passwort');
//koniec połączenia
//baza danych
$mydb = new DB();
$qwery = "SELECT `id`, `email` FROM mail_data Where sended=" . $checkbox_value;
$request = mysql_query($qwery);
if ($request === false) {
die('Nie można było odebrać danych do bazy' . ' z powodu blendu:' . mysql_error());
}
if (mysql_num_rows() == 0) {
echo 'Brak danych w bazie';
exit(1);
}
while ($row = mysql_fetch_assoc($request)) {
$id = $row['id'];
$address = $row['email'];
$mail->SetLanguage("pl", "phpmailer/language/");
$mail->CharSet = "UTF-8";
$mail->ContentType = "text/html";
$mail->isHTML(true);
$mail->From = user_mail;
$mail->FromName = "Kamil z webbooster";
$mail->Subject = "Tytuł wiadomości";
$mail->Body = '
To jest nowa testowa treść, z prawidłowo interpretowanymi polskimi znaczkami, a to jest <b>pogrubione</b>, a to jest <a href="http://www.example.com">link</a><br/>
<div>trolololo</div>
';
$mail->AddAddress($address);
if ($mail->Send()) {
return true;
} else {
throw new Exception('"E-mail nie mógł zostać wysłany, przyczyna :".$mail->ErrorInfo', 5);
}
}
//
$mail->SmtpClose();
//zamykamy połączeie
}
示例12: send
/**
* Sends the mail and returns whether that was successful.
*
* @return bool
*
* @global string The current language.
* @global array The configuration of the plugins.
* @global array The localization of the plugins.
* @global string The (X)HTML fragment that contains error messages.
*/
public function send()
{
global $sl, $plugin_cf, $plugin_tx, $e;
$pcf = $plugin_cf['advancedform'];
$ptx = $plugin_tx['advancedform'];
$type = strtolower($pcf['mail_type']);
$this->mail->LE = $pcf['mail_line_ending_*nix'] ? "\n" : "\r\n";
$this->mail->set('CharSet', 'UTF-8');
$this->mail->SetLanguage($sl, $this->pluginFolder . 'phpmailer/language/');
$this->mail->set('WordWrap', 72);
if (!$this->determineAddresses()) {
return false;
}
if ($this->isConfirmation) {
$this->mail->set('Subject', sprintf($ptx['mail_subject_confirmation'], $this->form->getTitle(), $_SERVER['SERVER_NAME']));
} else {
$this->mail->set('Subject', sprintf($ptx['mail_subject'], $this->form->getTitle(), $_SERVER['SERVER_NAME'], $_SERVER['REMOTE_ADDR']));
}
$this->mail->IsHtml($type != 'text');
if ($type == 'text') {
$this->mail->set('Body', $this->getBody(false));
} else {
$body = $this->getBody(true);
$this->mail->MsgHTML($body);
$this->mail->set('AltBody', $this->getBody(false));
}
if (!$this->isConfirmation) {
foreach ($this->form->getFields() as $field) {
$field = Field::make($field);
if ($field->getType() == 'file') {
$name = 'advfrm-' . $field->getName();
$this->mail->AddAttachment($_FILES[$name]['tmp_name'], stsl($_FILES[$name]['name']));
}
}
}
if (function_exists('advfrm_custom_mail')) {
$customResult = advfrm_custom_mail($this->form->getName(), $this->mail, $this->isConfirmation);
if ($customResult === false) {
return true;
}
}
$ok = $this->mail->Send();
if (!$this->isConfirmation) {
if (!$ok) {
$message = !empty($this->mail->ErrorInfo) ? XH_hsc($this->mail->ErrorInfo) : $ptx['error_mail'];
$e .= '<li>' . $message . '</li>' . PHP_EOL;
}
if (function_exists('XH_logMessage')) {
$type = $ok ? 'info' : 'error';
$message = $ok ? $ptx['log_success'] : $ptx['log_error'];
$message = sprintf($message, $this->mail->From);
XH_logMessage($type, 'Advancedform', $this->form->getName(), $message);
}
}
return $ok;
}
示例13: set
public function set($subject = '', $body = '', $m_cfg)
{
date_default_timezone_set('Asia/Shanghai');
//设定时区东八区
import('ORG.Net.PHPMailer.PHPMailerAutoload');
//import('ORG.Net.PHPMailer.smtp');
$mail = new PHPMailer();
$this->mailObj = $mail;
//new一个PHPMailer对象出来
$body = preg_replace("/\\*/", '', $body);
//对邮件内容进行必要的过滤
$mail->CharSet = "UTF-8";
//设定邮件编码,默认ISO-8859-1
$mail->IsSMTP();
// 设定使用SMTP服务
$mail->SMTPDebug = 1;
$mail->SetLanguage('zh_cn');
// 启用SMTP调试功能
$mail->IsError = 1;
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true;
// 启用 SMTP 验证功能
if ($m_cfg['ssl']) {
$ssl = true;
} else {
$ssl = false;
}
$mail->SMTPSecure = $ssl;
// 安全协议
$mail->Host = $m_cfg['smtp'];
// SMTP 服务器
$mail->Port = $m_cfg['port'];
// SMTP服务器的端口号
$mail->Username = $m_cfg['email'];
// SMTP服务器用户名
$mail->Password = $m_cfg['pwd'];
// SMTP服务器密码
$mail->SetFrom($m_cfg['email'], $m_cfg['username']);
$mail->AddReplyTo($m_cfg['email'], $m_cfg['username']);
$mail->Subject = $subject;
$mail->AltBody = '';
$mail->MsgHTML($body);
//$mail->AddAttachment("images/phpmailer.gif"); // attachment
if (!$mail->Send()) {
return false;
} else {
return true;
}
}
示例14: SendMail
function SendMail($toAddress, $toName, $subject, $messageBody, $bcc = NULL, $mailList = FALSE)
{
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/Main.php";
if ($mailList) {
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/MailService2.php";
} else {
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/MailService.php";
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/PHPMailer/class.phpmailer.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/PHPMailer/class.pop3.php";
if ($MailServiceAuthPOP3) {
$pop = new POP3();
$pop->Authorise($MailServicePOP3Addr, $MailServicePOP3Port, 30, $MailServiceSMTPUser, $MailServiceSMTPPass, $MailServicePOPDebug);
}
$mail = new PHPMailer();
if ($MailServiceMailerLang != "en") {
$mail->SetLanguage($MailServiceMailerLang, $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/PHPMailer/language/");
}
$mail->IsSMTP();
$mail->SMTPDebug = $MailServiceSMTPDebug;
$mail->Port = $MailServiceSMTPPort;
$mail->SMTPSecure = $MailServiceEncrypt;
$mail->Host = $MailServiceSMTPAddr;
$mail->SMTPAuth = $MailServiceAuthSMTP;
$mail->Username = $MailServiceSMTPUser;
$mail->Password = $MailServiceSMTPPass;
$mail->From = $MailServiceFromMail;
$mail->FromName = $MailServiceFromName;
$mail->AddAddress($toAddress, $toName);
if ($bcc != NULL) {
if (is_array($bcc)) {
foreach ($bcc as $key => $value) {
$mail->AddBCC($value);
}
}
}
$mail->WordWrap = 50;
$mail->CharSet = $MailServiceMsgCharset;
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $messageBody;
if ($mail->Send()) {
return true;
} else {
return $mail->ErrorInfo;
}
}
示例15: switch
/**
* Constructor.
*/
function __construct()
{
require_once PHPMAILER_CLASS;
require_once PHPMAILER_SMTP;
require_once PHPMAILER_POP3;
// Inicializa la instancia PHPMailer.
$mail = new \PHPMailer();
// Define el idioma para los mensajes de error.
$mail->SetLanguage("es", PHPMAILER_LANGS);
// Define la codificación de caracteres del mensaje.
$mail->CharSet = "UTF-8";
// Define el ajuste de texto a un número determinado de caracteres en el cuerpo del mensaje.
$mail->WordWrap = 50;
// Define el tipo de gestor de correo
switch (GOTEO_MAIL_TYPE) {
default:
case "mail":
$mail->isMail();
// set mailer to use PHP mail() function.
break;
case "sendmail":
$mail->IsSendmail();
// set mailer to use $Sendmail program.
break;
case "qmail":
$mail->IsQmail();
// set mailer to use qmail MTA.
break;
case "smtp":
$mail->IsSMTP();
// set mailer to use SMTP
$mail->SMTPAuth = GOTEO_MAIL_SMTP_AUTH;
// enable SMTP authentication
$mail->SMTPSecure = GOTEO_MAIL_SMTP_SECURE;
// sets the prefix to the servier
$mail->Host = GOTEO_MAIL_SMTP_HOST;
// specify main and backup server
$mail->Port = GOTEO_MAIL_SMTP_PORT;
// set the SMTP port
$mail->Username = GOTEO_MAIL_SMTP_USERNAME;
// SMTP username
$mail->Password = GOTEO_MAIL_SMTP_PASSWORD;
// SMTP password
break;
}
$this->mail = $mail;
}