当前位置: 首页>>代码示例>>PHP>>正文


PHP phpmailer类代码示例

本文整理汇总了PHP中phpmailer的典型用法代码示例。如果您正苦于以下问题:PHP phpmailer类的具体用法?PHP phpmailer怎么用?PHP phpmailer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了phpmailer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: activateUser

 /**
  * Activate a given user.
  * @param	$id				Identifier of user.
  * @param	$activationKey	Activation key for user.
  */
 function activateUser($id, $activationKey)
 {
     if (!empty($id) && !empty($activationKey)) {
         global $dbi;
         global $lActivate;
         $result = $dbi->query("SELECT username,activationKey FROM " . userTableName . " WHERE id=" . $dbi->quote($id));
         if ($result->rows()) {
             list($username, $activationKeyDB) = $result->fetchrow_array();
             if ($activationKey == $activationKeyDB) {
                 $dbi->query("UPDATE " . userTableName . " SET registered=registered,lastUpdated=lastUpdated,lastLogged=lastLogged,activated=1,activationKey='' WHERE id=" . $dbi->quote($id));
                 // Send confirmation email
                 $result = $dbi->query("SELECT name,email FROM " . userDataTableName . " WHERE id=" . $dbi->quote($id));
                 if ($result->rows()) {
                     list($name, $email) = $result->fetchrow_array();
                     // Send activation email
                     $mail = new phpmailer();
                     $mail->CharSet = "UTF-8";
                     $mail->Sender = pageAdminMail;
                     $mail->From = pageAdminMail;
                     $mail->FromName = pageTitle;
                     $mail->Subject = $lActivate["MailSubject"];
                     $mail->Body = sprintf($lActivate["MailMessage"], $name, $username);
                     $mail->IsHTML(false);
                     $mail->AddAddress($email);
                     $mail->Send();
                 }
                 echo '<p>' . $lActivate["HeaderText"] . '</p>';
             } else {
                 echo '<p>' . $lActivate["HeaderTextError"] . '</p>';
             }
         }
     }
 }
开发者ID:gkathir15,项目名称:catmis,代码行数:38,代码来源:Login.class.php

示例2: f_SEND

 function f_SEND($t_email = '', $t_asunto = '', $t_contenido)
 {
     require_once '../modelo/phpmailer/class.phpmailer.php';
     $a_email = new phpmailer();
     $a_email->Mailer = "smtp";
     $a_email->Host = "";
     $a_email->SMTPAuth = true;
     $a_email->Port = '465';
     $a_email->CharSet = 'utf8';
     $a_email->Username = '';
     $a_email->Password = '';
     $a_email->From = '';
     $a_email->FromName = '' . utf8_decode('');
     //escribir la el contenido del correo
     //dirección destino
     $a_correo = '' . $t_email;
     $a_email->addAddress($a_correo);
     $a_email->Subject = '' . utf8_decode('' . $t_asunto);
     $a_email->AddEmbeddedImage('../imagenes/inen_header.png', 'logoinen', 'inen_header.png');
     $a_email->IsHTML(true);
     $a_email->Body = "<p><img src=\"cid:logoinen\" /></p><p>" . utf8_decode('' . $t_contenido) . "</p>";
     $a_email->AltBody = ' ';
     if ($a_email->send()) {
         echo "</br>Mensaje enviado correctamente.</br>";
     } else {
         echo "<br/><strong>Información:</strong><br/>" . $a_email->ErrorInfo;
     }
 }
开发者ID:kruben84ec,项目名称:izel,代码行数:28,代码来源:cc_CORREO.php

示例3: send

 /**
  * Send mail, similar to PHP's mail
  *
  * A true return value does not automatically mean that the user received the
  * email successfully. It just only means that the method used was able to
  * process the request without any errors.
  *
  * The default content type is 'text/plain' which does not allow using HTML.
  */
 public static function send($from_email, $from_name, array $to, $subject, $message, array $cc = array(), array $bcc = array(), array $attachments = array())
 {
     $mailer = new phpmailer();
     $content_type = 'text/plain';
     $mailer->ContentType = $content_type;
     $mailer->Hostname = \lib\conf\constants::$domain;
     $mailer->IsMail();
     $mailer->IsHTML(false);
     $mailer->From = $from_email;
     $mailer->FromName = $from_name;
     // add recipients
     foreach ((array) $to as $recipient_name => $recipient_email) {
         $mailer->AddAddress(trim($recipient_email), trim($recipient_name));
     }
     // Add any CC and BCC recipients
     foreach ($cc as $recipient_name => $recipient_email) {
         $mailer->AddCc(trim($recipient_email), trim($recipient_name));
     }
     foreach ($bcc as $recipient_name => $recipient_email) {
         $mailer->AddBcc(trim($recipient_email), trim($recipient_name));
     }
     // Set mail's subject and body
     $mailer->Subject = $subject;
     $mailer->Body = $message;
     foreach ($attachments as $attachment) {
         $mailer->AddAttachment($attachment);
     }
     // Send!
     $result = $mailer->Send();
     return $result;
 }
开发者ID:revcozmo,项目名称:dating,代码行数:40,代码来源:mail.php

示例4: __construct

 function __construct()
 {
     $mail = new phpmailer();
     $mail->IsSMTP();
     //$mail->IsMail();
     $mail->SMTPAuth = true;
     // enable SMTP authentication
     $mail->SMTPSecure = "ssl";
     // sets the prefix to the servier
     $mail->Host = SMTP_HOST;
     // sets GMAIL as the SMTP server
     $mail->Port = SMTP_PORT;
     // set the SMTP port for the GMAIL server
     $mail->Username = SMTP_USERNAME;
     // GMAIL username
     $mail->Password = SMTP_PASSWORD;
     // GMAIL password
     $mail->AddReplyTo(EMAIL_FROM, "");
     $mail->From = EMAIL_FROM;
     $mail->FromName = EMAIL_FROM_NAME;
     $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
     // optional, comment out and test
     $mail->WordWrap = 50;
     // set word wrap
     $this->_mail = $mail;
 }
开发者ID:business-expert,项目名称:prnsc,代码行数:26,代码来源:email.php

示例5: proc_upd

 public function proc_upd()
 {
     $obj = ormPages::get(system::POST('obj_id'));
     $obj->tabuList('pseudo_url', 'h1', 'keywords', 'title', 'description', 'active', 'is_home_page', 'view_in_menu', 'view_submenu', 'in_search', 'in_index', 'in_new_window', 'other_link', 'img_act', 'img_no_act', 'img_h1');
     $obj->loadFromPost();
     // Публикация на сайте
     if (system::POST('publ', isBool)) {
         if ($obj->isInheritor('faq') && $obj->newVal('answer') == '') {
             ui::MessageBox(lang::get('TEXT_MESSAGE_ERROR'), lang::get('FEEDBACK_MSG_3'));
             ui::selectErrorFields(array('select' => '', 'focus' => 'answer'));
         } else {
             $obj->active = 1;
         }
     }
     $obj_id = $obj->save();
     // Если объект не сохранился, выводим пользователю текст ошибки.
     if ($obj_id === false) {
         system::savePostToSession();
         ui::MessageBox(lang::get('TEXT_MESSAGE_ERROR'), $obj->getErrorListText());
         ui::selectErrorFields($obj->getErrorFields());
         system::redirect('/feedback/message_upd/' . $_POST['obj_id']);
     }
     if (system::POST('send_to_email', isBool) && !$obj->send_answer_to_user && ($form_obj = ormObjects::get($obj->form_id))) {
         if ($form_obj->send_answer) {
             if ($obj->answer != '') {
                 $fields = $obj->getClass()->loadFields();
                 while (list($num, $field) = each($fields)) {
                     if (!empty($field['f_sname'])) {
                         page::assign($field['f_sname'], $obj->__get($field['f_sname']));
                     }
                 }
                 page::assign('site_name', domains::curDomain()->getSiteName());
                 page::assign('base_email', domains::curDomain()->getEmail());
                 $mail = new phpmailer();
                 $mail->From = $this->parse($form_obj->answer_sender_address);
                 $mail->FromName = $this->parse($form_obj->answer_sender_name);
                 $mail->AddAddress($obj->email);
                 $mail->WordWrap = 50;
                 $mail->IsHTML(true);
                 $mail->Subject = $this->parse($form_obj->answer_subject);
                 $mail->Body = $this->parse($form_obj->answer_template);
                 $mail->Send();
                 // Помечаем, что ответ отправлен
                 $obj->send_answer_to_user = 1;
                 $obj->save();
                 ui::MessageBox(lang::get('FEEDBACK_MSG_1'), '');
             } else {
                 ui::MessageBox(lang::get('TEXT_MESSAGE_ERROR'), lang::get('FEEDBACK_MSG_2'));
                 ui::selectErrorFields(array('select' => '', 'focus' => 'answer'));
             }
         }
     }
     // Если данные изменились корректно перенаправляем на соответствующию страницу
     if ($_POST['parram'] == 'apply') {
         system::redirect('/feedback/message_upd/' . $obj_id);
     } else {
         system::redirect('/feedback');
     }
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:59,代码来源:__message.php

示例6: sendQRmail

function sendQRmail($from, $to, $subject, $msg, $qrcodeImage, $cid, $name)
{
    include_once 'inc/class.phpmailer.php';
    $mail = new phpmailer();
    $mail->SMTPDebug = 0;
    // debugging: 1 = errors and messages, 2 = messages only, 0 = off
    $mail->IsSMTP();
    // Set mailer to use SMTP
    $mail->Host = 'mailhub.eait.uq.edu.au';
    // Specify server
    $mail->Port = 25;
    // Server port: 465 ssl OR  587 tls
    //$mail->SMTPSecure = 'tls';                       // Enable encryption, 'ssl' also accepted
    $mail->SMTPAuth = false;
    // Enable SMTP authentication
    $mail->Username = 's4329663@student.uq.edu.au';
    // SMTP username
    $mail->Password = 'hongzhe123999';
    // SMTP password
    $mail->SetFrom($from, 'QRappi');
    // Sender
    $mail->AddReplyTo($from, 'Support');
    // Set an alternative reply-to address
    $mail->AddAddress($to, 'User');
    // Set who the message is to be sent to
    $mail->Subject = $subject;
    // Set the subject line
    // Prepares message for html (see doc for details http://phpmailer.worxware.com/?pg=tutorial)
    $mail->MsgHTML($msg);
    // Add the image to the email as an inline element (i.e. not as an attachment)
    $mail->AddStringEmbeddedImage($qrcodeImage, $cid, $name);
    // Send the message, check for errors
    $ok = $mail->Send();
    return $ok;
}
开发者ID:Hongzhe,项目名称:DECO3801-PeerTech,代码行数:35,代码来源:mail.php

示例7: autosend

	 * @param string mailto address
	 * @param string mail content
	 * @param array word replace rules
	 *
	 */
    public static function autosend($mailto, $content, $replace = null)
    {
        foreach ($replace as $k => $v) {
            $content = str_replace($k, $v, $content);
        }
        $to = array();
        if (is_string($mailto)) {
            $to[0] = $mailto;
        }
        assert(trim($mailto) == '');
        Mail::_send($to, $content);
    }
    /**
	 * Basic send function.
	 * @param array mailto list
	 * @param string content
	 * @param array attachment path list
	 */
    private static function _send($mailto, $content, $title = '', $attachment = null)
    {
        require_once 'phpmailer/class.phpmailer.php';
        #echo "Begin!<br/>";
        if ($title == '') {
            $title = '来自IBM Power大赛官方的自动邮件,请勿直接回复本邮件。';
        }
        $mail = new phpmailer();
        // defaults to using php "mail()"
        $mail->IsSmtp();
        // telling the class to use SendMail transport
        #$body = 'hello cxj!<br/>';
        #$body = eregi_replace("[\]",'',$body);
        $config = C('PHPMAILER');
        $address = $config['FROM'];
        $password = $config['PASSWORD'];
        $smtp = $config['HOST'];
        $port = $config['PORT'];
        #$mail->AddReplyTo($address,"First Last");
        foreach ($mailto as $m) {
            $mail->AddAddress($m, "Power大赛参赛选手 {$m} ");
        }
        $mail->SMTPAuth = true;
        //$mail->from = $address;
        //$mail->to = $address;
        $mail->smtpsecure = 'ssl';
        $mail->From = $address;
开发者ID:sysuzjz,项目名称:soya,代码行数:50,代码来源:Mail.class.php

示例8: a2b_mail

function a2b_mail($to, $subject, $mail_content, $from = 'root@localhost', $fromname = '', $contenttype = 'multipart/alternative')
{
    $mail = new phpmailer();
    $mail->From = $from;
    $mail->FromName = $fromname;
    //$mail -> IsSendmail();
    //$mail -> IsSMTP();
    $mail->Subject = $subject;
    $mail->Body = nl2br($mail_content);
    //$HTML;
    $mail->AltBody = $mail_content;
    // Plain text body (for mail clients that cannot read 	HTML)
    // if ContentType = multipart/alternative -> HTML will be send
    $mail->ContentType = $contenttype;
    $mail->AddAddress($to);
    $mail->Send();
}
开发者ID:sayemk,项目名称:a2billing,代码行数:17,代码来源:Misc.inc.php

示例9: sendmail

function sendmail($subject, $mailcontent, $receiver, $receivername, $attachment = "")
{
    if (strpos($_SERVER['HTTP_HOST'], "localhost")) {
        return false;
    }
    $mail = new phpmailer();
    $mail->IsSMTP();
    $mail->Host = "mail.pepool.com";
    $mail->Port = 2525;
    $mail->SMTPAuth = true;
    $mail->Username = "info+pepool.com";
    // Write SMTP username in ""
    $mail->Password = "*VTWqNzPNKlut";
    $mail->Mailer = "smtp";
    $mail->IsHTML(true);
    $mail->ClearAddresses();
    $mail->From = "info@pepool.com";
    $mail->FromName = "pepool";
    $mail->Subject = $subject;
    $mail->Body = $mailcontent;
    $mail->AddAddress($receiver, $receivername);
    if ($attachment != '') {
        $mail->AddAttachment($attachment);
    }
    $suc = $mail->Send();
    return $suc > 0;
}
开发者ID:gauravstomar,项目名称:Pepool,代码行数:27,代码来源:Mail.php

示例10: sendList

 function sendList($list)
 {
     // send email of message
     global $loader, $intl, $conf;
     $loader->import('saf.Ext.phpmailer');
     $mail = new phpmailer();
     $mail->IsMail();
     $mail->IsHTML(true);
     foreach ($list as $item) {
         if (strtoupper($item->type) == 'TASK') {
             $id = 'T' . $item->id;
         } elseif (strtoupper($item->type) == 'MESSAGE') {
             $id = 'M' . $item->id;
         } else {
             $id = strtoupper(substr($item->type, 0, 1)) . $item->id;
         }
         $mail->From = $conf['Messaging']['return_address'];
         //$mail->Subject = '[' . $this->id . '] ' . $this->subject;
         //$mail->Body = $this->body;
         $mail->AddAddress($item->address);
         if (defined('WORKSPACE_' . strtoupper($item->type) . '_' . strtoupper($this->name) . '_SUBJECT')) {
             $mail->Subject = $intl->get(constant('WORKSPACE_' . strtoupper($item->type) . '_' . strtoupper($this->name) . '_SUBJECT'), $item->struct);
         } else {
             $mail->Subject = '[' . $id . '] ' . $item->subject;
         }
         if (defined('WORKSPACE_' . strtoupper($item->type) . '_' . strtoupper($this->name) . '_BODY')) {
             $mail->Body = $intl->get(constant('WORKSPACE_' . strtoupper($item->type) . '_' . strtoupper($this->name) . '_BODY'), $item->struct);
         } else {
             $mail->Body = $item->body;
         }
         if ($item->priority == 'urgent' || $item->priority == 'high') {
             $mail->Priority = 1;
         } else {
             $mail->Priority = 3;
         }
         if (!$mail->Send()) {
             $this->error = $mail->ErrorInfo;
             return false;
         }
         $mail->ClearAddresses();
         $mail->ClearAttachments();
     }
     return true;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:44,代码来源:Email.php

示例11: sendEmail

 protected function sendEmail($to, $subject, $body)
 {
     include_once '../../libraries/phpmailer/class.phpmailer.php';
     if (empty($to)) {
         return false;
     }
     $mail = new phpmailer();
     $mail->PluginDir = '../../libraries/phpmailer';
     $mail->CharSet = 'UTF-8';
     $mail->Subject = substr(stripslashes($subject), 0, 900);
     $mail->From = 'noreply@arisgames.org';
     $mail->FromName = 'ARIS Mailer';
     $mail->AddAddress($to, 'ARIS Author');
     $mail->MsgHTML($body);
     $mail->WordWrap = 79;
     if ($mail->Send()) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:kimblemj,项目名称:server,代码行数:21,代码来源:utils.php

示例12: send_mail

function send_mail($email, $date, $time)
{
    require '../phpmailer/PHPMailerAutoload.php';
    $mail = new phpmailer();
    $mail->isSMTP();
    $mail->Host = 'smtp.gmail.com';
    $mail->SMTPAuth = true;
    $mail->Username = 'sulemartin87@gmail.com';
    $mail->Password = 'Kisamymum96';
    $mail->SMTPSecure = 'tls';
    $mail->Port = 587;
    $mail->setFrom('sulemartin87@gmail.com', 'Mailer');
    $mail->addAddress('' . $email . '', 'user');
    $mail->isHTML(true);
    $mail->Subject = 'booking';
    $mail->Body = 'This email is coming from global styling to: ' . $email . ' </br>
								your booking is set for ' . $date . ' at ' . $time . ' 
								thank you for booking with us. Global Styling';
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
    if (!$mail->send()) {
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
    } else {
        echo 'Message has been sent to your E-Mail address';
    }
}
开发者ID:sulemartin87,项目名称:assignment,代码行数:26,代码来源:success_booking.php

示例13: send

 function send($newsletter_id)
 {
     global $db;
     $owpDBTable = owpDBGetTables();
     $send_mail = new phpmailer();
     $send_mail->From = OWP_EMAIL_ADDRESS;
     $send_mail->FromName = OWP_NAME;
     $send_mail->Subject = $this->title;
     $sql = "SELECT admin_gender, admin_firstname, admin_lastname,\n                     admin_email_address \n              FROM " . $owpDBTable['administrators'] . " \n              WHERE admin_newsletter = '1'";
     $mail_values = $db->Execute($sql);
     while ($mail = $mail_values->fields) {
         $send_mail->Body = $this->content;
         $send_mail->AddAddress($mail['admin_email_address'], $mail['admin_firstname'] . ' ' . $mail['admin_lastname']);
         $send_mail->Send();
         // Clear all addresses and attachments for next loop
         $send_mail->ClearAddresses();
         $send_mail->ClearAttachments();
         $mail_values->MoveNext();
     }
     $today = date("Y-m-d H:i:s");
     $db->Execute("UPDATE " . $owpDBTable['newsletters'] . " \n                       SET date_sent = " . $db->DBTimeStamp($today) . ",\n                           status = '1' \n                     WHERE newsletters_id = '" . owpDBInput($newsletter_id) . "'");
 }
开发者ID:BackupTheBerlios,项目名称:osiswebprinter,代码行数:22,代码来源:newsletter.php

示例14: send

 function send()
 {
     // send email of message
     global $loader, $intl, $conf;
     $loader->import('saf.Ext.phpmailer');
     $mail = new phpmailer();
     $mail->IsMail();
     if (strtoupper($this->type) == 'TASK') {
         $this->id = 'T' . $this->id;
     } elseif (strtoupper($this->type) == 'MESSAGE') {
         $this->id = 'M' . $this->id;
     } else {
         $this->id = strtoupper(substr($this->type, 0, 1)) . $this->id;
     }
     $mail->From = $conf['Messaging']['return_address'];
     if (defined('WORKSPACE_' . strtoupper($this->type) . '_' . strtoupper($this->name) . '_SUBJECT')) {
         $mail->Subject = $intl->get(constant('WORKSPACE_' . strtoupper($this->type) . '_' . strtoupper($this->name) . '_SUBJECT'), $this);
     } else {
         $mail->Subject = '[' . $this->id . '] ' . $intl->get('Notice');
     }
     if (defined('WORKSPACE_' . strtoupper($this->type) . '_' . strtoupper($this->name) . '_BODY')) {
         $mail->Body = $intl->get(constant('WORKSPACE_' . strtoupper($this->type) . '_' . strtoupper($this->name) . '_BODY'), $this);
     } else {
         $mail->Body = $this->subject;
     }
     // message body should be less than $this->charlimit characters
     $mail->Body = substr($mail->Body, 0, $this->charlimit);
     $mail->AddAddress($this->address);
     if ($this->priority == 'urgent' || $this->priority == 'high') {
         $mail->Priority = 1;
     }
     if ($mail->Send()) {
         return true;
     }
     $this->error = $mail->ErrorInfo;
     return false;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:37,代码来源:SMS.php

示例15: send_email

 function send_email($content)
 {
     require "PHPMailer/class.phpmailer.php";
     //Instanciamos un objeto de la clase phpmailer
     $mail = new phpmailer();
     //Indicamos a la clase phpmailer donde se encuentra la clase smtp
     //$mail->PluginDir = "";
     //Indicamos que vamos a conectar por smtp
     $mail->Mailer = "smtp";
     $mail->CharSet = "UTF-8";
     //Nuestro servidor smtp. Como ves usamos cifrado ssl
     $mail->Host = "ssl://smtp.gmail.com";
     //Puerto de gmail 465
     $mail->Port = "465";
     //Le indicamos que el servidor smtp requiere autenticación
     $mail->SMTPAuth = true;
     //Le decimos cual es nuestro nombre de usuario y password
     $mail->Username = "thlink.desarrollo@gmail.com";
     $mail->Password = "Thlink0013";
     //Indicamos cual es nuestra dirección de correo y el nombre que
     //queremos que vea el usuario que lee nuestro correo
     $mail->From = "contacto@inbest.me";
     $mail->FromName = "Nuevo registro en iNBest";
     //El valor por defecto de Timeout es 10, le voy a dar un poco mas
     $mail->Timeout = 30;
     //Indicamos cual es la dirección de destino del correo.
     $mail->AddAddress("Inbest@inbest.me");
     //$mail->AddCC("contacto@sths.com.mx");
     //Asignamos asunto
     $mail->Subject = "Nuevo Registro a través del sitio de iNBest - Solicita más Información";
     //Cuerpo del mensaje. Puede contener html
     $mail->Body = $content;
     //Si no admite html
     $mail->AltBody = "Cuerpo de mensaje solo texto";
     //Envia en email
     $resultado = $mail->Send();
 }
开发者ID:sylverman,项目名称:inbest,代码行数:37,代码来源:procesar.php


注:本文中的phpmailer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。