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


PHP PHPMailer::AddEmbeddedImage方法代码示例

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


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

示例1: smtpmailer

function smtpmailer($to, $from, $from_name, $subject, $avatar, $user, $username, $password)
{
    global $error;
    $mail = new PHPMailer();
    // create a new object
    $mail->IsSMTP();
    // enable SMTP
    $mail->SMTPDebug = 0;
    // debugging: 1 = errors and messages, 2 = messages only
    $mail->SMTPAuth = true;
    // authentication enabled
    $mail->SMTPSecure = 'ssl';
    // secure transfer enabled REQUIRED for GMail
    $mail->Host = 'smtp.gmail.com';
    $mail->Port = 465;
    $mail->Username = GUSER;
    $mail->Password = GPWD;
    $mail->IsHTML(true);
    $mail->SetFrom($from, $from_name);
    $mail->Subject = $subject;
    $mail->AddEmbeddedImage('background1.jpg', 'background1img');
    $name = explode($avatar, '.');
    $mail->AddEmbeddedImage('templates/avatars/' . $avatar, 'avatarimg');
    $mail->Body = "<div style='width:100%;background:rgb(77, 16, 1);height:500px;font-size:20px;color:#fff'>\n\t\t<font face='century Gothic,sans-serif'>\n\t\t<img src='cid:background1img' style='z-index:-2;text-align:center;margin-left:210px;width:300px;'>\n\t\t\n\t\t<div style='margin-left:0px;margin-top:30px;text-align:center;'><img src='cid:avatarimg' style='width:100px;height:100px;padding:1px;border:3px solid #ddd;margin-top:5px;margin-left:-5px;' /><div style='margin-top:5px;margin-left:-5px;'>Hello " . $user . "</div>\n\t\t\t<p style='text-align:justify;max-width:500px;margin-left:120px;'>\n\t\t\t<table>\n\t\t\t</table> </p>\n\t\t\n\t\t<div style='text-align:center'><br>\n\t\t<p style='text-align:center'>Your Accout details<br><br>\n\t\t<table style='text-align:left;margin-left:36%'>\n\t\t<tr><td style='padding-right:20px'>UserId</td><td>:" . $username . "</td></tr>\n\t\t<tr><td style='padding-right:20px'>New Password</td><td>:" . $password . "</td></tr>\n\t\t</table> </div>\n\t\t</div>\n\t\t<div style='color:#fff;font-size:18px;position:absolute;bottom:0px;margin-left:100px;'>\n\t\tRegards<br>\n\t\tAkhil Reddy<br>\n\t\tH-Rep VK-BHAWAN<br>\n\t\t850066489<br><br>\n\t\t</div>\t\t\n\t\t</div>\n\t\t</font></div>";
    $mail->AddAddress($to);
    if (!$mail->Send()) {
        $error = 'Mail error: ' . $mail->ErrorInfo;
        return false;
    } else {
        $error = 'Confirmation Mail sent to the the provided mail!';
        return true;
    }
}
开发者ID:TEJATJ,项目名称:BITSQ,代码行数:33,代码来源:forgotPassword.php

示例2: smtpmailer

function smtpmailer($to, $from, $from_name, $subject, $avatar, $user, $link)
{
    global $error;
    $mail = new PHPMailer();
    // create a new object
    $mail->IsSMTP();
    // enable SMTP
    $mail->SMTPDebug = 0;
    // debugging: 1 = errors and messages, 2 = messages only
    $mail->SMTPAuth = true;
    // authentication enabled
    $mail->SMTPSecure = 'ssl';
    // secure transfer enabled REQUIRED for GMail
    $mail->Host = 'smtp.gmail.com';
    $mail->Port = 465;
    $mail->Username = GUSER;
    $mail->Password = GPWD;
    $mail->IsHTML(true);
    $mail->SetFrom($from, $from_name);
    $mail->Subject = $subject;
    $mail->AddEmbeddedImage('background1.jpg', 'background1img');
    $name = explode($avatar, '.');
    $mail->AddEmbeddedImage('templates/avatars/' . $avatar, 'avatarimg');
    $mail->Body = "<div style='width:100%;background-color:rgb(77, 16, 1);height:500px;font-size:20px;color:#fff'>\n\t\t<font face='century Gothic,sans-serif'>\n\t\t<img src='cid:background1img' style='z-index:-2;text-align:center;margin-left:195px;width:300px;'>\n\t\t\n\t\t<div style='margin-left:0px;margin-top:30px;text-align:center;'><img src='cid:avatarimg' style='width:100px;height:100px;padding:1px;border:3px solid #ddd;margin-top:5px;margin-left:-5px;' /><div style='margin-top:5px;margin-left:-5px;'>Hello " . $user . "</div>\n\t\t\t<p style='text-align:justify;max-width:500px;margin-left:120px;'>\"Campus Connect\" is an initiative by a group of student enthusiasts, aiming to solve some of the issues faced by BITSians.\"BITS QUORA\" is one of the many projects covered under this initiative. </p>\n\t\t\n\t\t<div style='text-align:center'><br>\n\t\t<p style='text-align:center'><a href='http://BITSQ/register.php?token=" . $link . "&mail=" . $to . "' style='margin-top:18px;color:#fff;text-decoration:none;cursor:pointer;background:green;padding:6px;border:2 px solid darkgreen;border-radius:2px'>Click here to confirm your mail.</a></p> </div>\n\t\t</div>\n\t\t<div style='color:#fff;font-size:18px;position:absolute;bottom:0px;margin-left:100px;'>\n\t\tRegards<br>\n\t\tAkhil Reddy<br>\n\t\tH-Rep VK-BHAWAN<br>\n\t\t7728835792<br><br>\n\t\t</div>\t\t\n\t\t</div>\n\t\t</font></div>";
    $mail->AddAddress($to);
    if (!$mail->Send()) {
        $error = 'Mail error: ' . $mail->ErrorInfo;
        return false;
    } else {
        $error = 'Confirmation Mail sent to the the provided mail!';
        return true;
    }
}
开发者ID:TEJATJ,项目名称:BITSQ,代码行数:33,代码来源:validateNewUser.php

示例3: sendMail

function sendMail($subscriberEmail, $subject, $body)
{
    $timezone = "Asia/Calcutta";
    date_default_timezone_set($timezone);
    $mail = new PHPMailer();
    $mail->CharSet = 'UTF-8';
    $mail->IsSMTP();
    // set mailer to use SMTP^M
    $mail->Host = MAIL_HOST;
    // specify main and backup server^M
    $mail->SMTPAuth = true;
    // turn on SMTP authentication^M
    $mail->Username = MAIL_FROM;
    // Gmail username for smtp.gmail.com -- CHANGE --^M
    $mail->Password = MAIL_FROM_PWD;
    // SMTP password -- CHANGE --^M
    $mail->Port = MAIL_PORT;
    // SMTP Port^M
    $mail->Subject = $subject;
    $mail->AddEmbeddedImage('img/qrcode.jpg', 'qrcode');
    $mail->MsgHTML($body);
    //echo $body;
    $mail->IsHTML(true);
    $mail->SetFrom(MAIL_FROM, 'Effervescence IIITA');
    $mail->From = MAIL_FROM;
    //From Address -- CHANGE --^M
    $mail->FromName = "Effervescence IIITA";
    //From Name -- CHANGE --^M
    $mail->AddAddress($subscriberEmail, "");
    //To Address -- CHANGE --^M
    if (!$mail->Send()) {
        return 0;
    }
    return 1;
}
开发者ID:shubhamsharma24,项目名称:Website-EffervescenceMMXIV,代码行数:35,代码来源:mailFunctions.php

示例4: mailsend

function mailsend($subjects, $emailto, $body, $fName, $lName)
{
    $mail = new PHPMailer();
    $mail->Host = 'smtp.gmail.com';
    // Specify main and backup SMTP servers
    $mail->isSMTP();
    $mail->SMTPAuth = true;
    // Enable SMTP authentication
    $mail->Username = 'zainsheikh434@gmail.com';
    // SMTP username
    $mail->Password = '5121472masumeen';
    // SMTP password
    $mail->SMTPSecure = 'ssl';
    // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 465;
    // TCP port to connect to
    $mail->From = "zainsheikh434@gmail.com";
    $mail->FromName = "Honliz";
    $mail->addAddress($emailto);
    //Recipient //Name is optional
    $mail->Subject = $subjects;
    $mail->AddEmbeddedImage("photo/honliz_logo1.png", "my-attach", "photo/honliz_logo1.png");
    $mail->Body = $body;
    $mail->addReplyTo('zainsheikh434@gmail.com', 'Honliz Admin');
    $mail->isHTML(true);
    if (!$mail->send()) {
        //  echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
    }
}
开发者ID:ahmedmuqaddas94,项目名称:Honliz,代码行数:30,代码来源:register_user.php

示例5: 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

示例6: enviaEdoCuenta

 private function enviaEdoCuenta($contrato)
 {
     $documento = View::make('cobranza/reportes/EdoCuentaPorCorreo')->with('info', $this->response->generaEdoCuentaMensual($contrato));
     require "PHPMailer/PHPMailerAutoload.php";
     // path to the PHPMailer class.
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->Mailer = "smtp";
     $mail->SMTPSecure = 'ssl';
     $mail->Host = "smtp.gmail.com";
     $mail->Port = "465";
     $mail->SMTPAuth = true;
     $mail->Username = "abraham.f.machuca.vazquez@gmail.com";
     $mail->Password = "mavaabflo030785";
     $mail->From = "abraham.f.machuca.vazquez@gmail.com";
     $mail->FromName = "Yo";
     $mail->AddAddress("abraham.f.machuca.vazquez@gmail.com", "Yo");
     $mail->isHTML(true);
     $mail->AddEmbeddedImage('img/castilla_c.png', 'castilla_c');
     $mail->Subject = "Estado de cuenta mensual";
     $mail->Body = $documento;
     if ($mail->Send()) {
         return View::make('cobranza/mensajeCobranza')->with('datos', array('icono' => 'glyphicon glyphicon-send', 'seccion' => 'Cobranza | Reportes | Estado de cuenta mensual', 'cabecera' => 'Estado de cuenta mensual', 'tipo_mensaje' => true, 'mensaje' => 'El estado de cuenta mensual se ha enviado de manera satisfactoria'));
     } else {
         return View::make('cobranza/mensajeCobranza')->with('datos', array('icono' => 'glyphicon glyphicon-send', 'seccion' => 'Cobranza | Reportes | Estado de cuenta mensual', 'cabecera' => 'Estado de cuenta mensual', 'tipo_mensaje' => false, 'mensaje' => 'No se ha podido envíar el estado de cuenta mensual al cliente'));
     }
 }
开发者ID:vipomx,项目名称:Castilla,代码行数:27,代码来源:ReportesController.php

示例7:

    /**
     * An embedded attachment test.
     */
    function test_Multi_Embedded_Image()
    {

        $this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .
          "Here is an image!</a>";
        $this->Mail->Subject .= ": Embedded Image + Attachment";
        $this->Mail->IsHTML(true);

        if (!$this->Mail->AddEmbeddedImage(
	        __DIR__ . "/test.png",
            "my-attach",
            "test.png",
            "base64",
            "image/png"
        )
        ) {
            $this->assertTrue(false, $this->Mail->ErrorInfo);
            return;
        }

        if (!$this->Mail->AddAttachment(__FILE__, "test.txt")) {
            $this->assertTrue(false, $this->Mail->ErrorInfo);
            return;
        }

        $this->BuildBody();
        $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo);
    }
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:31,代码来源:phpmailerTest.php

示例8: 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']);
         }
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:33,代码来源:Mailer.php

示例9: smtpmailer

function smtpmailer($to, $from, $from_name, $subject, $body)
{
    global $error;
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPDebug = 0;
    $mail->Debugoutput = 'html';
    $mail->SMTPAuth = true;
    // authentication enabled
    $mail->SMTPSecure = 'tls';
    // secure transfer enabled REQUIRED for Gmail
    $mail->Host = "smtp.gmail.com";
    $mail->Port = 587;
    // 465 or 587
    $mail->Username = GUSER;
    $mail->Password = GPWD;
    $mail->From = $from;
    $mail->FromName = $from_name;
    $mail->Subject = $subject;
    $mail->IsHTML(true);
    $mail->Body = $body;
    $mail->AddAddress($to);
    //$mail->AddCC('retos@campus-party.com.mx');
    $mail->AddEmbeddedImage('../img/logo.png', 'logopng', 'logo.png');
    if ($mail->send()) {
        $error = 'Message sent';
        return true;
    } else {
        $error = 'Mail error fkt: ' . $mail->ErrorInfo;
        return false;
    }
}
开发者ID:danylopez,项目名称:pamiderc,代码行数:32,代码来源:send.php

示例10: getMailInstance

 public static function getMailInstance($mailSenderInfo = 'default', $imageUrl = '')
 {
     $mail = new \PHPMailer();
     $config = Config::getInstance();
     $mail->IsSMTP();
     $mail->SMTPAuth = $config->email('smtp.auth');
     $mail->Host = $config->email('smtp.host');
     $mail->Port = $config->email('smtp.port');
     //$mail->SMTPSecure = $config->email('smtp.secure');
     //$mail->Username = $config->email('smtp.username');
     //$mail->Password = $config->email('smtp.password');
     $fromEmail = $config->email($mailSenderInfo . '.email');
     $mail->From = empty($fromEmail) ? $config->getInstance()->getPartnerEmail() : $fromEmail;
     $fromName = $config->email($mailSenderInfo . '.name');
     $mail->FromName = empty($fromName) ? $config->getInstance()->getPartnerName() . ' Affiliates Team' : $fromName;
     $newPassword = $config->email($mailSenderInfo . '.password');
     if (!empty($newPassword)) {
         $mail->Username = $config->email($mailSenderInfo . '.email');
         $mail->Password = $newPassword;
     }
     if (strlen($imageUrl) > 0) {
         $mail->AddEmbeddedImage($imageUrl, 'img_newsletter', 'img_newsletter.jpg', 'base64', 'application/octet-stream');
     }
     return $mail;
 }
开发者ID:ashmna,项目名称:MedDocs,代码行数:25,代码来源:Mail.php

示例11: sendEBEmail

 static function sendEBEmail($to, $subject, $content, $FromNameMail = '', $images = array())
 {
     $FromNameMail = WEB_NAME;
     require_once 'includes/mailer/PHPMailer_v5.1/class.phpmailer.php';
     $mail = new PHPMailer();
     //$mail->CharSet 		= 'utf-8';
     $mail->IsSMTP();
     //$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
     //$mail->SetLanguage("vn",ROOT_PATH.'includes/mailer/PHPMailer_v5.1/');
     $mail->Host = SMTP_HOST;
     $mail->SMTPSecure = SMTP_SECURE;
     //For PHPMailer_v5.1
     $mail->Port = SMTP_PORT;
     $mail->SMTPAuth = SMTP_AUTH;
     $mail->SMTPSecure = SMTP_SECURE;
     $mail->Username = SMTP_USER;
     // SMTP username
     $mail->Password = SMTP_PASS;
     // SMTP password
     $mail->From = SMTP_FROM_EMAIL;
     // Email duoc gui tu???
     $mail->FromName = WEB_NAME;
     // Ten hom email duoc gui
     //$mail->SetFrom(SMTP_FROM_EMAIL, WEB_NAME);
     $mail->AddReplyTo(SMTP_FROM_EMAIL, WEB_NAME);
     $mail->AddAddress($to, "");
     // Dia chi email va ten nhan
     $mail->Subject = $subject;
     // Chu de email
     $mail->IsHTML(true);
     // Gui theo dang HTML
     $mail->Body = $content;
     // Noi dung html
     $mail->AltBody = 'Để xem được nội dung Email này, hãy sử dụng một trình duyệt Email tương thích với mã HTML! (To view the message, please use an HTML compatible email viewer!)';
     //optional - MsgHTML will create an alternate automatically
     if (!empty($images)) {
         $mail->message_type = 'attachments';
         foreach ($images as $img) {
             if (!empty($img)) {
                 $ext = AZLib::getExtension($img['src']);
                 $img['mime'] = 'image/' . substr(strtolower($ext), 1, strlen($ext));
                 $mail->AddEmbeddedImage($img['src'], $img['id'], $img['title'], 'base64', $img['mime']);
             }
         }
         //cau hinh nhu sau <img src="cid:ubzsed" />
     }
     if (!$mail->Send()) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:duynhan07,项目名称:elink,代码行数:52,代码来源:System.php

示例12:

 /**
  * An embedded attachment test.
  */
 function test_Multi_Embedded_Image()
 {
     $this->Mail->Body = 'Embedded Image: <img alt="phpmailer" src="cid:my-attach">' . 'Here is an image!</a>';
     $this->Mail->Subject .= ': Embedded Image + Attachment';
     $this->Mail->IsHTML(true);
     if (!$this->Mail->AddEmbeddedImage('test.png', 'my-attach', 'test.png', 'base64', 'image/png')) {
         $this->assertTrue(false, $this->Mail->ErrorInfo);
         return;
     }
     if (!$this->Mail->AddAttachment(__FILE__, 'test.txt')) {
         $this->assertTrue(false, $this->Mail->ErrorInfo);
         return;
     }
     $this->BuildBody();
     $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo);
 }
开发者ID:nikamipara,项目名称:SEN,代码行数:19,代码来源:phpmailerTest.php

示例13: sendMail

function sendMail($assunto, $mensagem, $destino, $nomeDestino, $reply = NULL, $replyNome = NULL, $anexo = NULL, $logo)
{
    $mail = new PHPMailer();
    //INICIA A CLASSE
    $mail->IsSMTP();
    //Habilita envio SMPT
    $mail->SMTPAuth = true;
    //Ativa email autenticado
    $mail->IsHTML(true);
    $mail->CharSet = "UTF-8";
    // Charset da mensagem (opcional)
    /* Protocolo da conexão */
    //$mail->SMTPSecure = "ssl";
    $mail->Host = 'connectja.com.br';
    //Servidor de envio
    $mail->Port = 25;
    //Porta de envio
    $mail->Username = 'site@connectja.com.br';
    //email para smtp autenticado
    $mail->Password = 'connectja123';
    //seleciona a porta de envio
    $mail->From = 'site@connectja.com.br';
    //remetente
    $mail->FromName = 'Connect - Internet Banda Larga';
    //nome remetente
    /* Enviar imagem */
    $mail->AddEmbeddedImage($logo, 'connect');
    if ($reply != NULL) {
        $mail->AddReplyTo($reply, $replyNome);
    }
    if ($anexo != NULL) {
        $mail->AddAttachment($anexo);
    }
    $mail->Subject = $assunto;
    //assunto
    $mail->Body = $mensagem;
    //mensagem
    $mail->AddAddress($destino, $nomeDestino);
    //email e nome do destino
    if ($mail->Send()) {
        return true;
    } else {
        exit;
        return false;
    }
}
开发者ID:ITEVA,项目名称:siteConnect,代码行数:46,代码来源:EnviarEmail.php

示例14: sendEmail

function sendEmail($email, $nombre, $unique)
{
    error_reporting(E_ALL);
    require_once "PHPMailer_5.2.4/class.phpmailer.php";
    $mail = new PHPMailer();
    //$mail->IsSendmail();
    $mail->IsSMTP();
    // set mailer to use SMTP
    $mail->SMTPDebug = 0;
    $mail->From = "jjsalazar.cambronero@gmail.com";
    $mail->FromName = "Juan Jose";
    $mail->Host = "smtp.emailsrvr.com";
    // specif smtp server
    //$mail->SMTPSecure= "ssl"; // Used instead of TLS when only POP mail is selected
    $mail->Port = 587;
    // Used instead of 587 when only POP mail is selected
    $mail->SMTPAuth = true;
    $mail->Username = "juan.salazar@grupopol.com";
    // SMTP username
    $mail->Password = "juan1salazar";
    // SMTP password
    $mail->AddAddress($email, $nombre);
    //replace myname and mypassword to yours
    $mail->AddEmbeddedImage('images/' . $unique . 'image.png', 'logoimg', $unique . 'image.png');
    //$path = $_SERVER['DOCUMENT_ROOT'] . 'Prueba/MailerTest/filename.png';
    //$mail->AddAttachment($path);
    $mail->AddReplyTo("jjsalazar.cambronero@gmail.com", "Juan Salazar");
    //$mail->WordWrap = 50; // set word wrap
    //$mail->AddAttachment("c:\\temp\\js-bak.sql"); // add attachments
    //$mail->AddAttachment("c:/temp/11-10-00.zip");
    $mail->IsHTML(true);
    // set email format to HTML
    $mail->Subject = 'test';
    $mail->Body = 'test';
    if ($mail->Send()) {
        return true;
        //echo "Send mail successfully";
    } else {
        return false;
        //echo "Send mail fail" . $mail->ErrorInfo;
    }
}
开发者ID:jjsalazarc,项目名称:registrationform,代码行数:42,代码来源:test.php

示例15: send

function send($subj, $body, $mails, $smtp)
{
    $m = new \PHPMailer();
    $body = preg_replace_callback('~images/([^"\']+)~', function ($matches) use($m) {
        static $n = 0;
        static $pics = array();
        $path = $matches[0];
        $name = $matches[1];
        if (!isset($pics[$path])) {
            $n++;
            $pics[$path] = 'img' . $n;
            $m->AddEmbeddedImage($path, $pics[$path], $name);
        }
        $cid = $pics[$path];
        return 'cid:' . $cid;
    }, $body);
    $m->CharSet = 'utf-8';
    $m->Subject = $subj;
    $m->Body = $body;
    $m->isHTML(true);
    $m->isSMTP();
    $m->SMTPAuth = true;
    $m->Password = $smtp['password'];
    $m->Username = $smtp['user'];
    $m->Host = $smtp['host'];
    if (isset($smtp['port'])) {
        $m->Port = $smtp['port'];
    }
    $mails = (array) $mails;
    foreach ($mails as $address) {
        $m->addAddress($address);
    }
    $m->From = 'robot@doc.loc';
    $m->FromName = 'Робот Док';
    $res = $m->send();
    if (!$res) {
        throw new \Exception($m->ErrorInfo);
    }
    return $res;
}
开发者ID:dubrowsky,项目名称:docland,代码行数:40,代码来源:send.php


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