本文整理汇总了PHP中PHPMailer::IsSendmail方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::IsSendmail方法的具体用法?PHP PHPMailer::IsSendmail怎么用?PHP PHPMailer::IsSendmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPMailer
的用法示例。
在下文中一共展示了PHPMailer::IsSendmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMail
function sendMail($to, $subject, $message, $fromAddress = '', $fromUserName = '', $toName = '', $bcc = '', $upload_dir = '', $filename = '')
{
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "mail.taggerzz.com";
$mail->Port = 25;
$mail->IsSendmail();
$mail->IsHTML(true);
$mail->ClearAddresses();
$find = strpos($to, ',');
if ($find) {
$ids = explode(',', $to);
for ($i = 0; $i < count($ids); $i++) {
$mail->AddAddress($ids[$i]);
}
} else {
$mail->AddAddress($to);
}
if ($fromAddress != '') {
$mail->From = $fromAddress;
} else {
$mail->From = "no-reply@taggerzz.com";
}
if ($fromUserName != '') {
$mail->FromName = $fromUserName;
} else {
$mail->FromName = "TAGGERZZ";
}
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $message;
if ($upload_dir != '') {
foreach ($upload_dir as $uploaddirs) {
$mail->AddAttachment($uploaddirs, $filename);
}
}
if ($mail->Send()) {
return 1;
} else {
return 0;
}
}
示例2: Sendemail
function Sendemail($to, $subject, $message, $repyto, $from, $fromname)
{
try {
$mail = new PHPMailer(true);
//New instance, with exceptions enabled
$mail->IsSMTP();
// tell the class to use SMTP
$mail->SMTPAuth = false;
// enable SMTP authentication
$mail->IsSendmail();
// tell the class to use Sendmail
$mail->AddReplyTo($repyto, $fromname);
$mail->From = $from;
$mail->FromName = $fromname;
$mail->AddAddress($to);
$mail->Subject = $subject;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
// optional, comment out and test
$mail->WordWrap = 80;
// set word wrap
$mail->MsgHTML($message);
$mail->IsHTML(true);
// send as HTML
$mail->Send();
return true;
} catch (phpmailerException $e) {
//echo $e->errorMessage();
}
}
示例3: PFMailSend
public function PFMailSend($sender, $param)
{
$Aufgabe = ProtokollDetailAufgabeView::finder()->findByidtm_protokoll_detail($param->CallbackParameter);
$MailEmpfaenger = OrganisationRecord::finder()->findByPk($Aufgabe->idtm_organisation);
$mail = new PHPMailer();
$mail->From = "info@planlogiq.com";
$mail->FromName = "planlogIQ";
$mail->Host = "smtp.1und1.de";
$mail->Mailer = "smtp";
$mail->SMTPAuth = true;
$mail->IsSendmail();
//nur bei 1und1
$mail->Username = "info@planlogiq.com";
$mail->Password = "";
$mail->AddAddress(KommunikationRecord::finder()->find('idtm_organisation=? AND kom_ismain=1 AND kom_type = 3', $Aufgabe->idtm_organisation)->kom_information, $MailEmpfaenger->org_name);
$mail->Subject = $Aufgabe->prtdet_topic;
$HTMLMessage = "Sehr geehrte(r) Frau/Herr " . $MailEmpfaenger->org_name . ",<br/><br/>";
$HTMLMessage .= "die folgende Aufgabe wurde Ihnen zugeordnet:<br/>";
$HTMLMessage .= "<p><table><tr><td bgcolor='#efefef'>TOP Nr.:</td><td>" . $Aufgabe->idtm_protokoll_detail_group . " </td><td bgcolor='#efefef'>Thema: </td><td>" . utf8_decode($Aufgabe->prtdet_topic) . "</td></tr>";
$HTMLMessage .= "<tr><td bgcolor='#efefef'>Bis:</td><td colspan='3'><b>" . $Aufgabe->auf_tdate . "</b></td></tr></table>";
$HTMLMessage .= "<p style='background-color:#efefef'><hr/>" . utf8_decode($Aufgabe->prtdet_descr) . "</p>";
$HTMLMessage .= "<p style='background-color:#efefef'><hr/>" . utf8_decode($Aufgabe->auf_beschreibung) . "<hr/></p>";
$HTMLMessage .= "Bitte nicht Antworten! Diese Mail wurde automatisch generiert...";
$mail->MsgHTML($HTMLMessage);
if (!$mail->Send()) {
$this->PFMAILER->TEXT = "error sending the message";
} else {
$this->PFMAILER->TEXT = "..done..";
}
}
示例4: kdmail
function kdmail($f)
{
$this->load('lib/phpmailer/class.phpmailer');
$mail = new PHPMailer();
//$body = $mail->getFile(ROOT.'index.php');
//$body = eregi_replace("[\]",'',$body);
$mail->IsSendmail();
// telling the class to use SendMail transport
$mail->From = $f["from"];
$mail->FromName = either($f["fromname"], "noticer");
$mail->Subject = either($f["subject"], "hello");
//$mail->AltBody = either($f["altbody"], "To view the message, please use an HTML compatible email viewer!"); // optional, comment out and test
$mail->AltBody = either($f["msg"], "To view the message, please use an HTML compatible email viewer!");
// optional, comment out and test
if ($f["embedimg"]) {
foreach ($f["embedimg"] as $i) {
//$mail->AddEmbeddedImage(ROOT."public/images/logo7.png","logo","logo7.png");
$mail->AddEmbeddedImage($i[0], $i[1], $i[2]);
}
}
if ($f["msgfile"]) {
$body = $mail->getFile($f["msgfile"]);
$body = eregi_replace("[\\]", '', $body);
if ($f["type"] == "text") {
$mail->IsHTML(false);
$mail->Body = $body;
} else {
$mail->MsgHTML($body);
//."<br><img src= \"cid:logo\">");
}
} else {
if ($f["type"] == "text") {
$mail->IsHTML(false);
$mail->Body = $f["msg"];
} else {
$mail->MsgHTML($f["msg"]);
//."<br><img src= \"cid:logo\">");
}
}
if (preg_match('/\\,/', $f["to"])) {
$emails = explode(",", $f["to"]);
foreach ($emails as $i) {
$mail->AddAddress($i, $f["toname"]);
}
} else {
$mail->AddAddress($f["to"], $f["toname"]);
}
$mail->AddBCC($this->config["site"]["mail"], "bcc");
if ($f["files"]) {
foreach ($f["files"] as $i) {
$mail->AddAttachment($i);
// attachment
}
}
if (!$mail->Send()) {
return "Mailer Error: " . $mail->ErrorInfo;
} else {
return "Message sent!";
}
}
示例5: dest_mail
function dest_mail()
{
global $WORKING, $STATIC;
$WORKING['STEPTODO'] = filesize($STATIC['JOB']['backupdir'] . $STATIC['backupfile']);
$WORKING['STEPDONE'] = 0;
trigger_error(sprintf(__('%d. try to sending backup with mail...', 'backwpup'), $WORKING['DEST_MAIL']['STEP_TRY']), E_USER_NOTICE);
//Create PHP Mailer
require_once realpath($STATIC['WP']['ABSPATH'] . $STATIC['WP']['WPINC']) . '/class-phpmailer.php';
$phpmailer = new PHPMailer();
//Setting den methode
if ($STATIC['CFG']['mailmethod'] == "SMTP") {
require_once realpath($STATIC['WP']['ABSPATH'] . $STATIC['WP']['WPINC']) . '/class-smtp.php';
$phpmailer->Host = $STATIC['CFG']['mailhost'];
$phpmailer->Port = $STATIC['CFG']['mailhostport'];
$phpmailer->SMTPSecure = $STATIC['CFG']['mailsecure'];
$phpmailer->Username = $STATIC['CFG']['mailuser'];
$phpmailer->Password = base64_decode($STATIC['CFG']['mailpass']);
if (!empty($STATIC['CFG']['mailuser']) and !empty($STATIC['CFG']['mailpass'])) {
$phpmailer->SMTPAuth = true;
}
$phpmailer->IsSMTP();
trigger_error(__('Send mail with SMTP', 'backwpup'), E_USER_NOTICE);
} elseif ($STATIC['CFG']['mailmethod'] == "Sendmail") {
$phpmailer->Sendmail = $STATIC['CFG']['mailsendmail'];
$phpmailer->IsSendmail();
trigger_error(__('Send mail with Sendmail', 'backwpup'), E_USER_NOTICE);
} else {
$phpmailer->IsMail();
trigger_error(__('Send mail with PHP mail', 'backwpup'), E_USER_NOTICE);
}
trigger_error(__('Creating mail', 'backwpup'), E_USER_NOTICE);
$phpmailer->From = $STATIC['CFG']['mailsndemail'];
$phpmailer->FromName = $STATIC['CFG']['mailsndname'];
$phpmailer->AddAddress($STATIC['JOB']['mailaddress']);
$phpmailer->Subject = sprintf(__('BackWPup archive from %1$s: %2$s', 'backwpup'), date('Y/m/d @ H:i', $STATIC['JOB']['starttime'] + $STATIC['WP']['TIMEDIFF']), $STATIC['JOB']['name']);
$phpmailer->IsHTML(false);
$phpmailer->Body = sprintf(__('Backup archive: %s', 'backwpup'), $STATIC['backupfile']);
//check file Size
if (!empty($STATIC['JOB']['mailefilesize'])) {
if (filesize($STATIC['JOB']['backupdir'] . $STATIC['backupfile']) > abs($STATIC['JOB']['mailefilesize'] * 1024 * 1024)) {
trigger_error(__('Backup archive too big for sending by mail!', 'backwpup'), E_USER_ERROR);
$WORKING['STEPDONE'] = 1;
$WORKING['STEPSDONE'][] = 'DEST_MAIL';
//set done
return;
}
}
trigger_error(__('Adding backup archive to mail', 'backwpup'), E_USER_NOTICE);
need_free_memory(filesize($STATIC['JOB']['backupdir'] . $STATIC['backupfile']) * 5);
$phpmailer->AddAttachment($STATIC['JOB']['backupdir'] . $STATIC['backupfile']);
trigger_error(__('Send mail....', 'backwpup'), E_USER_NOTICE);
if (false == $phpmailer->Send()) {
trigger_error(sprintf(__('Error "%s" on sending mail!', 'backwpup'), $phpmailer->ErrorInfo), E_USER_ERROR);
} else {
$WORKING['STEPTODO'] = filesize($STATIC['JOB']['backupdir'] . $STATIC['backupfile']);
trigger_error(__('Mail send!!!', 'backwpup'), E_USER_NOTICE);
}
$WORKING['STEPSDONE'][] = 'DEST_MAIL';
//set done
}
示例6: send
/**
* send an email
*
* @param string $toaddress
* @param string $toname
* @param string $subject
* @param string $mailtext
* @param string $fromaddress
* @param string $fromname
* @param bool $html
*/
public static function send($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '')
{
$SMTPMODE = OC_Config::getValue('mail_smtpmode', 'sendmail');
$SMTPHOST = OC_Config::getValue('mail_smtphost', '127.0.0.1');
$SMTPAUTH = OC_Config::getValue('mail_smtpauth', false);
$SMTPUSERNAME = OC_Config::getValue('mail_smtpname', '');
$SMTPPASSWORD = OC_Config::getValue('mail_smtppassword', '');
$mailo = new PHPMailer(true);
if ($SMTPMODE == 'sendmail') {
$mailo->IsSendmail();
} elseif ($SMTPMODE == 'smtp') {
$mailo->IsSMTP();
} elseif ($SMTPMODE == 'qmail') {
$mailo->IsQmail();
} else {
$mailo->IsMail();
}
$mailo->Host = $SMTPHOST;
$mailo->SMTPAuth = $SMTPAUTH;
$mailo->Username = $SMTPUSERNAME;
$mailo->Password = $SMTPPASSWORD;
$mailo->From = $fromaddress;
$mailo->FromName = $fromname;
$mailo->Sender = $fromaddress;
$a = explode(' ', $toaddress);
try {
foreach ($a as $ad) {
$mailo->AddAddress($ad, $toname);
}
if ($ccaddress != '') {
$mailo->AddCC($ccaddress, $ccname);
}
if ($bcc != '') {
$mailo->AddBCC($bcc);
}
$mailo->AddReplyTo($fromaddress, $fromname);
$mailo->WordWrap = 50;
if ($html == 1) {
$mailo->IsHTML(true);
} else {
$mailo->IsHTML(false);
}
$mailo->Subject = $subject;
if ($altbody == '') {
$mailo->Body = $mailtext . OC_MAIL::getfooter();
$mailo->AltBody = '';
} else {
$mailo->Body = $mailtext;
$mailo->AltBody = $altbody;
}
$mailo->CharSet = 'UTF-8';
$mailo->Send();
unset($mailo);
OC_Log::write('mail', 'Mail from ' . $fromname . ' (' . $fromaddress . ')' . ' to: ' . $toname . '(' . $toaddress . ')' . ' subject: ' . $subject, OC_Log::DEBUG);
} catch (Exception $exception) {
OC_Log::write('mail', $exception->getMessage(), OC_Log::ERROR);
throw $exception;
}
}
示例7: phpmail_send
function phpmail_send($from, $to, $subject, $message, $attachment_path = NULL, $cc = NULL, $bcc = NULL)
{
require_once APPPATH . 'modules_core/mailer/helpers/phpmailer/class.phpmailer.php';
$CI =& get_instance();
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->IsHtml();
if ($CI->mdl_mcb_data->setting('email_protocol') == 'smtp') {
$mail->IsSMTP();
$mail->SMTPAuth = true;
if ($CI->mdl_mcb_data->setting('smtp_security')) {
$mail->SMTPSecure = $CI->mdl_mcb_data->setting('smtp_security');
}
$mail->Host = $CI->mdl_mcb_data->setting('smtp_host');
$mail->Port = $CI->mdl_mcb_data->setting('smtp_port');
$mail->Username = $CI->mdl_mcb_data->setting('smtp_user');
$mail->Password = $CI->mdl_mcb_data->setting('smtp_pass');
} elseif ($CI->mdl_mcb_data->setting('email_protocol') == 'sendmail') {
$mail->IsSendmail();
}
if (is_array($from)) {
$mail->SetFrom($from[0], $from[1]);
} else {
$mail->SetFrom($from);
}
$mail->Subject = $subject;
$mail->Body = $message;
$to = strpos($to, ',') ? explode(',', $to) : explode(';', $to);
foreach ($to as $address) {
$mail->AddAddress($address);
}
if ($cc) {
$cc = strpos($cc, ',') ? explode(',', $cc) : explode(';', $cc);
foreach ($cc as $address) {
$mail->AddCC($address);
}
}
if ($bcc) {
$bcc = strpos($bcc, ',') ? explode(',', $bcc) : explode(';', $bcc);
foreach ($bcc as $address) {
$mail->AddBCC($address);
}
}
if ($attachment_path) {
$mail->AddAttachment($attachment_path);
}
if ($mail->Send()) {
if (isset($CI->load->_ci_classes['session'])) {
$CI->session->set_flashdata('custom_success', $CI->lang->line('email_success'));
return TRUE;
}
} else {
if (isset($CI->this->load->_ci_classes['session'])) {
$CI->session->set_flashdata('custom_error', $mail->ErrorInfo);
return FALSE;
}
}
}
示例8:
/**
* Test sending using SendMail
*/
function test_SendmailSend()
{
$this->Mail->Body = "Sending via sendmail";
$this->BuildBody();
$subject = $this->Mail->Subject;
$this->Mail->Subject = $subject . ": sendmail";
$this->Mail->IsSendmail();
$this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo);
}
示例9: sendReportEmail
function sendReportEmail($to, $from = "noreply@nubuilder.com", $content = "nuBuilder Email", $html = false, $subject = "", $wordWrap = 120, $filesource, $filename, $receipt = "false")
{
$mail = new PHPMailer();
// BEGIN - 2009/06/09 - Michael
switch ($GLOBALS["NUMailMethod"]) {
// Use the sendmail binary.
case "sendmail":
$mail->IsSendmail();
break;
// case
// Use an SMTP server to send the mail.
// case
// Use an SMTP server to send the mail.
case "smtp":
$mail->IsSMTP();
$mail->Host = !empty($GLOBALS["NUSMTPHost"]) ? $GLOBALS["NUSMTPHost"] : "127.0.0.1";
$mail->SMTPAuth = !empty($GLOBALS["NUSMTPUsername"]) ? true : false;
if ($mail->SMTPAuth) {
$mail->Username = !empty($GLOBALS["NUSMTPUsername"]) ? $GLOBALS["NUSMTPUsername"] : "";
$mail->Password = !empty($GLOBALS["NUSMTPPassword"]) ? $GLOBALS["NUSMTPPassword"] : "";
}
// if
// case
// Use PHP's built-in mail function.
// case
// Use PHP's built-in mail function.
case "mail":
default:
// Nothing to do, "mail" is the PHPMailer default.
// default
}
// switch
// END - 2009/06/09 - Michael
if ($receipt == "true") {
$mail->ConfirmReadingTo = $from;
}
if (empty($from)) {
$mail->From = 'noreply@nusoftware.com.au';
} else {
$mail->From = $from;
}
$mail->FromName = $fromname;
$toArray = explode(',', $to);
for ($i = 0; $i < count($toArray); $i++) {
if ($toArray[$i]) {
$mail->AddAddress($toArray[$i]);
}
}
$mail->WordWrap = $wordWrap;
$mail->IsHTML($html);
$mail->AddAttachment($filesource, $filename);
$mail->Subject = $subject;
$mail->Body = $content;
return $mail->Send();
}
示例10: sendMailSMTP
public function sendMailSMTP($template, $to, $data)
{
require 'PHPMailer/class.phpmailer.php';
$file = file($template);
//Get values from template mail
foreach ($file as $value) {
if ($value != "") {
list($key, $val) = explode("=>", $value);
$key = trim($key);
$val = trim($val);
${$key} = $val;
}
}
$body = str_replace('\\r\\n', '<br/>', $body);
try {
$mail = new PHPMailer(true);
//New instance, with exceptions enabled
$mail->IsSMTP();
// tell the class to use SMTP
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->Port = 25;
// set the SMTP server port
$mail->Host = "mail.gmail.com";
// SMTP server
$mail->Username = $from;
// SMTP server username
$mail->Password = "";
// SMTP server password
$mail->IsSendmail();
// tell the class to use Sendmail
$mail->AddReplyTo($from, "Brights consulting");
$mail->From = $from;
$mail->FromName = "Brights consulting";
$mail->AddAddress($to);
$mail->Subject = $subject;
$mail->AltBody = $body;
// optional, comment out and test
$mail->WordWrap = 80;
// set word wrap
$mail->MsgHTML($body);
$mail->IsHTML(true);
// send as HTML
if ($mail->Send()) {
return true;
}
} catch (phpmailerException $e) {
$e->errorMessage();
}
}
示例11:
/**
* Test sending using SendMail
*/
function test_SendmailSend()
{
// If this medium is not enabled, do not test it!
if($this->Mail->Mailer != 'sendmail'){
$this->markTestSkipped('sendmail not enabled, skipping send test');
return;
}
$this->Mail->Body = "Sending via sendmail";
$this->BuildBody();
$subject = $this->Mail->Subject;
$this->Mail->Subject = $subject . ": sendmail";
$this->Mail->IsSendmail();
$this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo);
}
示例12: 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;
}
示例13: PHPMailer
function send_basic_text_email($email_tos, $email_ccs, $email_subject, $email_message)
{
//following code adapted from phpMailer 2.2.1 README
$mail = new PHPMailer();
if (AppSettings::gv("smtp_server") == "localhost") {
$mail->IsSendmail();
} else {
$mail->IsSMTP();
// set mailer to use SMTP
$mail->Host = AppSettings::gv("smtp_server");
// specify main and backup server
$mail->SMTPAuth = true;
// turn on SMTP authentication
$mail->Username = AppSettings::gv("smtp_user");
// SMTP username
$mail->Password = AppSettings::gv("smtp_pass");
// SMTP password
}
$mail->From = AppSettings::gv("std_email_from");
$mail->FromName = "New England Trade";
foreach ($email_tos as $email_to) {
//$mail->AddAddress("josh@example.net", "Josh Adams");
//$mail->AddAddress("ellen@example.com"); // name is optional
$mail->AddAddress($email_to);
//echo "yo:".$email_to;
}
foreach ($email_ccs as $email_cc) {
$mail->AddCC($email_cc);
}
//$mail->AddReplyTo("info@example.com", "Information");
$mail->WordWrap = 50;
// set word wrap to 50 characters
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
//$mail->IsHTML(true); // set email format to HTML
$mail->Subject = $email_subject;
$mail->Body = $email_message;
//$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if (!$mail->Send()) {
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo . " ++";
echo "<p>Developer note: Maybe the email address is invalid? Please try changing the user email address. <a href='/index.php'>Go back</a> to site.";
exit;
}
return true;
//echo "Message has been sent";
}
示例14: send_mail
function send_mail($mail_to, $mail_body, $mail_subject = 'No title', $mail_name = 'No name', $mail_from = '', $mail_priority = 3, $mail_wordwrap = 50, $mail_altbody = '')
{
global $GO_CONFIG;
// $mail_to='ductk@hptvietnam.com.vn';
// $mail_from = 'bigduck1004@yahoo.com';
// $mail_name = "333";
// $mail_subject = 'subject';
// $mail_body = '123456789';
// $mail_altbody = 'qqqqqqqqqqqqqqqq';
require $GO_CONFIG->class_path . "phpmailer/class.phpmailer.php";
require $GO_CONFIG->class_path . "phpmailer/class.smtp.php";
$mail = new PHPMailer();
$mail->PluginDir = $GO_CONFIG->class_path . 'phpmailer/';
$mail->SetLanguage($php_mailer_lang, $GO_CONFIG->class_path . 'phpmailer/language/');
switch ($GO_CONFIG->mailer) {
case 'smtp':
$mail->Host = $GO_CONFIG->smtp_server;
$mail->Port = $GO_CONFIG->smtp_port;
$mail->IsSMTP();
break;
case 'qmail':
$mail->IsQmail();
break;
case 'sendmail':
$mail->IsSendmail();
break;
case 'mail':
$mail->IsMail();
break;
}
$mail->Priority = $mail_priority;
$mail->Sender = $mail_from;
$mail->From = $mail_from;
$mail->FromName = $mail_name;
$mail->AddReplyTo($mail_from, $mail_name);
$mail->WordWrap = $mail_wordwrap;
// $mail->Encoding = "quoted-printable";
$mail->IsHTML(true);
$mail->Subject = $mail_subject;
$mail->AddAddress($mail_to);
$mail->Body = $mail_body;
$mail->AltBody = $mail_altbody;
if (!$mail->Send()) {
return '<p class="Error">' . $ml_send_error . ' ' . $mail->ErrorInfo . '</p>';
}
}
示例15: enviareEmail
public static function enviareEmail($body)
{
try {
$mail = new PHPMailer(true);
//New instance, with exceptions enabled
$body = file_get_contents($body);
$body = preg_replace('/\\\\/', '', $body);
//Strip backslashes
$mail->IsSMTP();
// tell the class to use SMTP
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->Port = 587;
// set the SMTP server port
$mail->Host = "smtp.googlemail.com";
// SMTP server
$mail->Username = "";
// SMTP server username
$mail->Password = "";
// SMTP server password
$mail->IsSendmail();
// tell the class to use Sendmail
$mail->AddReplyTo("", "Egberto Monteiro");
$mail->From = "";
$mail->FromName = "Egberto Monteiro";
$to = "";
$mail->AddAddress($to);
$mail->Subject = "First PHPMailer Message";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
// optional, comment out and test
$mail->WordWrap = 80;
// set word wrap
$mail->MsgHTML($body);
$mail->IsHTML(true);
// send as HTML
$mail->Send();
echo 'Message has been sent.';
} catch (phpmailerException $e) {
echo $e->errorMessage();
}
}