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


PHP PHPMailer::AddAddress方法代码示例

本文整理汇总了PHP中PHPMailer::AddAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::AddAddress方法的具体用法?PHP PHPMailer::AddAddress怎么用?PHP PHPMailer::AddAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPMailer的用法示例。


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

示例1: sendMail

function sendMail($to, $subject, $message, $fromAddress = '', $fromUserName = '', $toName = '', $bcc = '', $upload_dir = '', $filename = '')
{
    try {
        $mail = new PHPMailer();
        $mail->IsSMTP();
        $mail->Host = "sm4.siteground.biz";
        $mail->Port = 2525;
        $mail->SMTPAuth = true;
        $mail->SMTPDebug = 1;
        // enables SMTP debug information (for testing)
        // Enable SMTP authentication
        $mail->Username = 'dileepkumarkonda@gmail.com';
        // SMTP username
        $mail->Password = 'samarasa@1234';
        // SMTP password
        $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 = "dileepkumarkonda@gmail.com";
        }
        if ($fromUserName != '') {
            $mail->FromName = $fromUserName;
        } else {
            $mail->FromName = "Video Collections";
        }
        $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;
        }
    } catch (phpmailerException $e) {
        echo $e->errorMessage();
        //Pretty error messages from PHPMailer
    } catch (Exception $e) {
        echo $e->getMessage();
        //Boring error messages from anything else!
    }
}
开发者ID:aapthi,项目名称:video-collections,代码行数:58,代码来源:sendmail.php

示例2: sendMail

function sendMail($to, $subject, $message, $fromAddress = '', $fromUserName = '', $toName = '', $bcc = '', $upload_dir = '', $filename = '')
{
    $mail = new PHPMailer();
    $mail->IsSMTP();
    // send via SMTP
    $mail->Host = "smtp.gmail.com";
    // SMTP servers
    $mail->SMTPAuth = true;
    // enable SMTP authentication
    $mail->SMTPSecure = "ssl";
    // use ssl
    //$mail->Host = "mail.vivateachers.org"; // GMAIL's SMTP server
    $mail->Port = 465;
    // SMTP port used by GMAIL server
    $mail->IsHTML(true);
    // [optional] send as HTML
    $mail->Username = "chandra.jampana@gmail.com";
    // SMTP username
    $mail->Password = "CHANDRA8143155535!";
    // SMTP password
    $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 = "chandra.jampana@gmail.com";
    }
    if ($fromUserName != '') {
        $mail->FromName = $fromUserName;
    } else {
        $mail->FromName = "MediCart";
    }
    $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;
    }
}
开发者ID:dileepkumar0234,项目名称:taxapplication,代码行数:55,代码来源:sendmail.php

示例3: array

 function wpsight_mail_send_email($data = array(), $opts = array())
 {
     if (!class_exists('PHPMailer')) {
         require ABSPATH . '/wp-includes/class-phpmailer.php';
     }
     $mail = new PHPMailer();
     $mail->CharSet = 'UTF-8';
     foreach ($data['recipients'] as $addr) {
         if (is_array($addr)) {
             $mail->AddAddress($addr[0], $addr[1]);
         } else {
             $mail->AddAddress($addr);
         }
     }
     $mail->Subject = isset($data['subject']) ? $data['subject'] : null;
     if (is_array($data['body']) && isset($data['body']['html'])) {
         $mail->isHTML(true);
         $mail->Body = $data['body']['html'];
         $mail->AltBody = isset($data['body']['text']) ? $data['body']['text'] : null;
     }
     $mail->From = $data['sender_email'];
     $mail->FromName = $data['sender_name'];
     if (isset($data['reply_to'])) {
         foreach ((array) $data['reply_to'] as $addr) {
             if (is_array($addr)) {
                 $mail->AddReplyTo($addr[0], $addr[1]);
             } else {
                 $mail->AddReplyTo($addr);
             }
         }
     }
     if (isset($data['attachments']) && is_array($data['attachments'])) {
         foreach ($data['attachments'] as $attachment) {
             $encoding = isset($attachment['encoding']) ? $attachment['encoding'] : 'base64';
             $type = isset($attachment['type']) ? $attachment['type'] : 'application/octet-stream';
             $mail->AddStringAttachment($attachment['data'], $attachment['filename'], $encoding, $type);
         }
     }
     if (isset($opts['transport']) && $opts['transport'] == 'smtp') {
         $mail->isSMTP();
         $mail->Host = $opts['smtp_host'];
         $mail->Port = isset($opts['smtp_port']) ? (int) $opts['smtp_port'] : 25;
         if (!empty($opts['smtp_user'])) {
             $mail->Username = $opts['smtp_user'];
             $mail->Password = $opts['smtp_pass'];
         }
         if (!empty($opts['smtp_sec'])) {
             $mail->SMTPSecure = $opts['smtp_sec'];
         }
     }
     do_action('wpsight_mail_pre_send', $mail, $data, $opts);
     return $mail->send() ? true : $mail->ErrorInfo;
 }
开发者ID:phucanh92,项目名称:vietlong,代码行数:53,代码来源:mail.php

示例4: handle

 public function handle($fromTitle, $fromMail, $toEmail, $subject, $body, $attachments, $smtpHost, $smtpPort, $serverLogin = '', $serverPassword = '', $charCode = 'UTF-8', $isHtml = false)
 {
     if (!is_object($this->_mail)) {
         $this->_mail = new PHPMailer();
     }
     $this->_mail->CharSet = $charCode;
     $this->_mail->IsHTML($isHtml);
     $this->_mail->From = $fromMail;
     $this->_mail->FromName = $fromTitle;
     $this->_mail->AddReplyTo($fromMail, $fromTitle);
     $this->_mail->Subject = $subject;
     $this->_mail->Body = $body;
     $this->_mail->AltBody = '';
     $this->_mail->AddAddress($toEmail, '');
     $this->_mail->IsSMTP(true);
     $this->_mail->Mailer = 'smtp';
     $this->_mail->Host = $smtpHost;
     $this->_mail->Port = $smtpPort;
     if ($serverLogin != '') {
         $this->_mail->SMTPAuth = true;
         $this->_mail->Username = $serverLogin;
         $this->_mail->Password = $serverPassword;
     } else {
         $this->_mail->SMTPAuth = false;
         $this->_mail->Username = '';
         $this->_mail->Password = '';
     }
     if (is_object($attachments)) {
         //FIXME
         //        // zalaczniki
         //for ($z = 0; $z < Count($tab_mail_oma_zalacznik[$tab_mail_id[$i]]); $z++) {
         //if (($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z] != '') AND (file_exists($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z]))) {
         //if ($tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z] == '') {
         //$this->_mail->AddAttachment($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z], basename($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z]));
         //} // koniec if...
         //else {
         //$this->_mail->AddEmbeddedImage($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z], $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z]);
         //$tmp_tresc = str_replace('[' . $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z] . ']', 'cid:' . $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z], $tmp_tresc);
         //} // koniec else...
         //} // koniec if...
         //} // koniec for...
     }
     if (!$this->_mail->Send()) {
         $status = false;
     } else {
         $status = true;
     }
     $this->_mail->ClearAddresses();
     $this->_mail->ClearAttachments();
     return $status;
 }
开发者ID:knatorski,项目名称:SMS,代码行数:51,代码来源:PHPMailer.php

示例5: send

 /**
  * Short description of method send
  *
  * @access public
  * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
  * @return int
  */
 public function send()
 {
     $returnValue = (int) 0;
     foreach ($this->messages as $message) {
         if ($message instanceof tao_helpers_transfert_Message) {
             $this->mailer->SetFrom($message->getFrom());
             $this->mailer->AddReplyTo($message->getFrom());
             $this->mailer->Subject = $message->getTitle();
             $this->mailer->AltBody = strip_tags(preg_replace("/<br.*>/i", "\n", $message->getBody()));
             $this->mailer->MsgHTML($message->getBody());
             $this->mailer->AddAddress($message->getTo());
             try {
                 if ($this->mailer->Send()) {
                     $message->setStatus(tao_helpers_transfert_Message::STATUS_SENT);
                     $returnValue++;
                 }
                 if ($this->mailer->IsError()) {
                     if (DEBUG_MODE) {
                         echo $this->mailer->ErrorInfo . "<br>";
                     }
                     $message->setStatus(tao_helpers_transfert_Message::STATUS_ERROR);
                 }
             } catch (phpmailerException $pe) {
                 if (DEBUG_MODE) {
                     print $pe;
                 }
             }
         }
         $this->mailer->ClearReplyTos();
         $this->mailer->ClearAllRecipients();
     }
     $this->mailer->SmtpClose();
     return (int) $returnValue;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:41,代码来源:MailAdapter.php

示例6: email

  function email($to, $subject, $body){
    $mail = new PHPMailer();

    $mail->SMTPAuth = true;
    $mail->SMTPSecure = "ssl";
    $mail->Host = "smtp.gmail.com";
    $mail->Port = 465;
    $mail->Username = "invitation@prescriptiveindex.ro";
    $mail->Password = "U8GWm&hM";

    $mail->SetFrom("invitation@prescriptiveindex.ro", "Invitatie Studiu/Study Invitation"); 

    if(is_array($to)){
        foreach($to as $t){
            $mail->AddAddress($t);                   
        }
    }else{
        $mail->AddAddress($to);
    }

    $mail->Subject = $subject;
    $mail->Body = $body;

    $res = !$mail->Send();
    unset($mail);
    return $res;
  }
开发者ID:razvanantonescu,项目名称:prescriptiveindex,代码行数:27,代码来源:email_sender.php

示例7: sendMailSent

function sendMailSent($To, $From_Name, $From, $Body, $Subject, $CC_Arr, $attachments, $today)
{
    # Let's valid the email address first
    #$validEmailResult = validEmail($To);
    #echo "validEmailResult = " . $validEmailResult;
    #echo "\nValid Email address found: " . $To . " Return Code for valid email is: " . $validEmailResult . "\n";
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->Host = "mail.2gdigital.com";
    $mail->SMTPAuth = false;
    $mail->From = $From;
    $mail->FromName = $From_Name;
    $mail->AddAddress($To);
    foreach ($CC_Arr as $CC_dude) {
        if ($CC_dude != $To) {
            $mail->AddAddress($CC_dude);
        }
    }
    $mail->IsHTML(true);
    $mail->Subject = $Subject;
    $mail->Body = $Body;
    foreach ($attachments as $attachment) {
        echo "2nd Attachment " . $attachment;
        $mail->AddAttachment($attachment);
    }
    if (!$mail->Send()) {
        echo "Message could not be sent." . "\n";
        echo "Mailer Error: " . $mail->ErrorInfo . "\n\n";
        exit;
    }
}
开发者ID:2gDigitalPost,项目名称:custom,代码行数:31,代码来源:default_emailer.php

示例8: 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!";
     }
 }
开发者ID:tranngocthang89,项目名称:basephpmvc,代码行数:60,代码来源:application.php

示例9: form

 function form()
 {
     if ($this->request->data) {
         $this->loadModel(CONTACT);
         $mail = new PHPMailer();
         $mail->From = $this->request->data->mail;
         $mail->FromName = $this->request->data->name;
         $message = $this->request->data->content;
         if ($this->request->data->sendcopy == 1) {
             $mail->AddAddress($this->request->data->mail);
             $message .= "<div><div dir=\"ltr\"><div><span style=\"color:rgb(11,83,148)\">Bien à vous,<i><b><br></b></span></span></div><div><span style=\"color:rgb(11,83,148)\"><i><b><br>WebPassions</b><br></span></span></div><div><span style=\"color:rgb(11,83,148)\">Lorge Vivian<br></span></div><div><span style=\"color:rgb(11,83,148)\"><i>0479/95.98.45</span><br></span></div><span style=\"color:rgb(11,83,148)\"><a target=\"_blank\" href=\"http://www.webpassions.be\"><i>http://www.webpassions.be</span></a></span><br><div><br><div><img width=\"96\" height=\"28\" src=\"http://www.webpassions.be/signature.png\"><br><br><br></div></div></div></div>";
         }
         $mail->IsHTML(true);
         $mail->CharSet = 'UTF-8';
         $mail->AddAddress($_SESSION['cmscontact']);
         $mail->AddReplyTo($_SESSION['cmscontact']);
         $mail->Subject = $_SESSION['cmscontactcategory'][$this->request->data->subject];
         $mail->Body = $message;
         if (!$mail->Send()) {
             $this->logger->LogError($this->request->controller, $this->request->action, $_SESSION[USER]->login, BackendTranslate::getLabel('send_error') . $mail->ErrorInfo);
             $this->Session->setAlert(BackendTranslate::getLabel('send_error') . $mail->ErrorInfo, DANGER);
         } else {
             $this->logger->LogInfo($this->request->controller, $this->request->action, $_SESSION[USER]->login, BackendTranslate::getLabel('send_mail'));
             $this->Session->setAlert(BackendTranslate::getLabel('send_mail'), SUCCESS);
         }
         unset($mail);
     }
 }
开发者ID:WebPassions,项目名称:2015,代码行数:28,代码来源:ContactController.php

示例10: send_email

function send_email($link, $username, $password, $email)
{
    if (!empty($link)) {
        $mail = new PHPMailer();
        $mail->IsSMTP();
        $mail->SMTPDebug = 0;
        $mail->SMTPAuth = true;
        $mail->SMTPSecure = 'ssl';
        $mail->Host = "smtp.gmail.com";
        $mail->Port = 465;
        $mail->Username = "nemoryoliver1@gmail.com";
        $mail->Password = "DhjkLmnOP2";
        $mail->From = "nemoryoliver@gmail.com";
        $mail->AddAddress($email);
        // for publishing
        $mail->AddAddress("nemoryoliver@gmail.com");
        // for development testing
        $mail->Subject = "BundledFun Group Registration";
        $mail->Body = "Username:" . $username . "\nPassword: " . $password . "\n\nClick on the link to confirm. \n\n" . $link;
        $mail->WordWrap = 50;
        if (!$mail->Send()) {
            echo 'Message was not sent.';
            echo 'Mailer error: ' . $mail->ErrorInfo;
        } else {
            echo 'Message has been sent.';
        }
    }
}
开发者ID:NemOry,项目名称:BundledFunWebPanel,代码行数:28,代码来源:functions.php

示例11: sendEmail

 /**
  * send an email
  *
  * @access public
  * @static static method
  * @param  string  $type Email constant - check config.php
  * @param  string  $email
  * @param  array   $userData
  * @param  array   $data any associated data with the email
  * @throws Exception If failed to send the email
  */
 public static function sendEmail($type, $email, $userData, $data)
 {
     $mail = new PHPMailer();
     $mail->IsSMTP();
     //good for debugging, otherwise keep it commented
     //$mail->SMTPDebug  = EMAIL_SMTP_DEBUG;
     $mail->SMTPAuth = EMAIL_SMTP_AUTH;
     $mail->SMTPSecure = EMAIL_SMTP_SECURE;
     $mail->Host = EMAIL_SMTP_HOST;
     $mail->Port = EMAIL_SMTP_PORT;
     $mail->Username = EMAIL_SMTP_USERNAME;
     $mail->Password = EMAIL_SMTP_PASSWORD;
     $mail->SetFrom(EMAIL_FROM, EMAIL_FROM_NAME);
     $mail->AddReplyTo(EMAIL_REPLY_TO);
     switch ($type) {
         case EMAIL_EMAIL_VERIFICATION:
             $mail->Body = self::getEmailVerificationBody($userData, $data);
             $mail->Subject = EMAIL_EMAIL_VERIFICATION_SUBJECT;
             $mail->AddAddress($email);
             break;
         case EMAIL_PASSWORD_RESET:
             $mail->Body = self::getPasswordResetBody($userData, $data);
             $mail->Subject = EMAIL_PASSWORD_RESET_SUBJECT;
             $mail->AddAddress($email);
             break;
         case EMAIL_REPORT_BUG:
             $mail->Body = self::getReportBugBody($userData, $data);
             $mail->Subject = "[" . ucfirst($data["label"]) . "] " . EMAIL_REPORT_BUG_SUBJECT . " | " . $data["subject"];
             $mail->AddAddress($email);
             break;
     }
     if (!$mail->Send()) {
         throw new Exception("Email couldn't be sent to " . $userData["id"] . " for type: " . $type);
     }
 }
开发者ID:E01T,项目名称:miniPHP,代码行数:46,代码来源:Email.php

示例12: correo

function correo($email_remitente,$nombre_remitente,$email_destino,$nombre_destino,$asunto,$mensaje,$copia1,$copia2,$copia3){

	require_once("class.phpmailer.php");
	$mail = new PHPMailer();
	$mail->From = $email_remitente;
	$mail->FromName = $nombre_remitente;
	$mail->AddAddress($email_destino, $nombre_destino);

	if($copia1!=""){
		$mail->AddAddress($copia1);
	}
	if($copia2!=""){
		$mail->AddAddress($copia2);
	}
	if($copia3!=""){
		$mail->AddAddress($copia3);
	}
	$mail->WordWrap = 50;                                 	// set word wrap to 50 characters
	$mail->IsHTML(true);                                  	// set email format to HTML
	$mail->Subject = $asunto;
	$mail->Body    = $mensaje;

	if(!$mail->Send()){
	   echo "Message could not be sent. <p>";
	   echo "Mailer Error: " . $mail->ErrorInfo;
	   exit;
	}
	/*echo "Message has been sent<br>";*/
}
开发者ID:rommelxcastro,项目名称:CRI-Online-Sales---Admin,代码行数:29,代码来源:correo.php

示例13: PHPMailer

 function envia_email($messageText, $subject, $emailFrom, $nameFrom)
 {
     require 'resources/lib/phpmailer/PHPMailerAutoload.php';
     $mail = new PHPMailer();
     $mail->isSMTP();
     // Define que a mensagem será SMTP
     $mail->Host = "smtp.gmail.com";
     // Endereço do servidor SMTP
     $mail->SMTPAuth = true;
     // Autenticação
     $mail->Username = 'rvcasorio@gmail.com';
     // Usuário do servidor SMTP
     $mail->Password = ':casorio2016';
     // Senha da caixa postal utilizada
     $mail->SMTPSecure = 'ssl';
     $mail->Port = 465;
     $mail->From = $emailFrom;
     $mail->FromName = $nameFrom;
     $mail->AddAddress('rvcasorio@gmail.com', "Noivos Tchutchucos");
     $mail->AddAddress('viniciuscosta90@gmail.com', "Noivo Sexy");
     $mail->AddReplyTo($emailFrom, $nameFrom);
     $mail->isHTML(true);
     // Define que o e-mail será enviado como HTML
     $mail->CharSet = 'iso-8859-1';
     // Charset da mensagem (opcional)
     $mail->Subject = $subject;
     // Assunto da mensagem
     $mail->Body = $messageText;
     return $mail->Send();
 }
开发者ID:viniciuscl,项目名称:casamento-rv,代码行数:30,代码来源:class.EnviaEmail.php

示例14: enviarEmail

function enviarEmail($razon, $body, $proyecto, $whoSend = 0)
{
    $con = mysqli_connect(DBhost, DBuser, DBpassword, DATABASE);
    $result = mysqli_query($con, "select * from proyecto_alumno_profesor where IDProyecto={$proyecto}");
    $IDS = mysqli_fetch_array($result);
    $idAlumno = $IDS['IDAlumno'];
    $idProfesor = $IDS['IDProfesor'];
    $result2 = mysqli_query($con, "select * from profesores where IDProfesor={$idProfesor}");
    $result3 = mysqli_query($con, "select * from alumnos where IDAlumno={$idAlumno}");
    $result4 = mysqli_query($con, "select * from proyectos where IDProyecto={$proyecto}");
    $alumnos = mysqli_fetch_array($result3);
    $profesores = mysqli_fetch_array($result2);
    $proyectos = mysqli_fetch_array($result4);
    $correoAlumno = $alumnos['Email'];
    $nombreAlumno = $alumnos['Nombre'];
    $correoProfesor = $profesores['Email'];
    $nombreProfesor = $profesores['Nombre'];
    $nombreProyecto = $proyectos['Descripcion'];
    $razonCompleta = $nombreProyecto . ": " . $razon;
    $mail = new PHPMailer();
    $mail->CharSet = 'UTF-8';
    $mail->IsSMTP();
    // Usar SMTP para enviar
    $mail->SMTPDebug = 0;
    // habilita información de depuración SMTP (para pruebas)
    // 1 = errores y mensajes
    // 2 = sólo mensajes
    $mail->SMTPAuth = true;
    // habilitar autenticación SMTP
    $mail->Host = HOST;
    // establece el servidor SMTP
    $mail->Port = PORT;
    // configura el puerto SMTP utilizado
    $mail->Username = USER;
    // nombre de usuario UGR
    $mail->Password = PASSWORD;
    // contraseña del usuario UGR
    $mail->SetFrom(ENVIARDESDE, NOMBREDESDE);
    $mail->Subject = "{$razonCompleta}";
    $mail->MsgHTML($body);
    // Fija el cuerpo del mensaje
    if ($whoSend == 0) {
        //envia el profesor al alumno
        $address = $correoAlumno;
        // Dirección del destinatario
        $mail->AddAddress($address, $nombreAlumno);
    } else {
        //envia alumno al tutor
        $address = $correoProfesor;
        // Dirección del destinatario
        $mail->AddAddress($address, $nombreProfesor);
    }
    $mail->Send();
    //$mail->AddBCC("soporteformacion@fucoda.es","Soporte formación");
    mysqli_close($con);
    //echo "$correoAlumno";
}
开发者ID:AitorG,项目名称:share-Proyect,代码行数:57,代码来源:mails.php

示例15: Send

 function Send()
 {
     $mail = new PHPMailer();
     $mail->CharSet = 'UTF-8';
     $mail->Host = $this->smtp['smtp_server'];
     $mail->Port = $this->smtp['smtp_port'];
     if ($this->smtp['smtp_enable']) {
         $mail->IsSMTP();
         $mail->Username = $this->smtp['smtp_usr'];
         $mail->Password = $this->smtp['smtp_psw'];
         $mail->SMTPAuth = $this->smtp['smtp_auth'] ? true : false;
     }
     if ($this->smtp['smtp_from_email']) {
         $mail->SetFrom($this->smtp['smtp_from_email'], $this->smtp['smtp_from_name']);
     } else {
         $mail->SetFrom($this->smtp['smtp_server'], $this->smtp['smtp_usr']);
     }
     if (is_array($this->to)) {
         foreach ($this->to as $key => $val) {
             $name = is_numeric($key) ? "" : $key;
             $mail->AddAddress($val, $name);
         }
     } else {
         $mail->AddAddress($this->to, $this->to_name);
     }
     if (!empty($this->smtp['smtp_reply_email'])) {
         $mail->AddReplyTo($this->smtp['smtp_reply_email'], $this->smtp['smtp_reply_name']);
     }
     if ($this->cc) {
         if (is_array($this->cc)) {
             foreach ($this->cc as $keyc => $valcc) {
                 $name = is_numeric($keyc) ? "" : $keyc;
                 $mail->AddCC($valcc, $name);
             }
         } else {
             $mail->AddCC($this->cc, $this->cc_name);
         }
     }
     if ($this->attach) {
         if (is_array($this->attach)) {
             foreach ($this->attach as $key => $val) {
                 $mail->AddAttachment($val);
             }
         } else {
             $mail->AddAttachment($this->attach);
         }
     }
     // 		$mail->SMTPSecure = 'ssl';
     $mail->SMTPSecure = "tls";
     $mail->WordWrap = 50;
     $mail->IsHTML($this->is_html);
     $mail->Subject = $this->subject;
     $mail->Body = $this->body;
     $mail->AltBody = "";
     // return $mail->Body;
     return $mail->Send();
 }
开发者ID:ngukho,项目名称:mvc-cms,代码行数:57,代码来源:Email.class.php


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