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


PHP phpmailer::AddEmbeddedImage方法代码示例

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


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

示例1: phpmailer

 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

示例2: emailSend

 function emailSend($data)
 {
     $stime = array_sum(explode(' ', microtime()));
     require_once "getmxrr.php";
     $smtp =& $this->params;
     $mail = new phpmailer();
     $mail->Mailer = "smtp";
     $mail->From = isset($data['from']) & !empty($data['from']) ? $data['from'] : 'info@rusoft.ru';
     $mail->FromName = isset($data['fromName']) & !empty($data['fromName']) ? $data['fromName'] : 'RuSoft';
     $mail->Sender = isset($data['from']) & !empty($data['from']) ? $data['from'] : 'info@rusoft.ru';
     $mail->Host = $smtp['host'];
     $mail->CharSet = $smtp['charset'];
     $mail->Encoding = $smtp['encoding'];
     $mail->Port = $smtp['port'];
     $mail->SMTPAuth = $smtp['auth'];
     $mail->Subject = isset($data['subj']) & !empty($data['subj']) ? $data['subj'] : '';
     if ($smtp['auth']) {
         $mail->Username = $smtp['user'];
         $mail->Password = $smtp['pass'];
     }
     // HTML body
     if (isset($data['mess']['html']) & !empty($data['mess']['html'])) {
         $body = $data['mess']['html'];
         $mail->isHTML(true);
     }
     // Plain text body (for mail clients that cannot read HTML)
     if (isset($data['mess']['text']) & !empty($data['mess']['text'])) {
         $text_body = $data['mess']['text'];
         $mail->isHTML(false);
     }
     $mail->AltBody = isset($text_body) ? $text_body : '';
     $mail->Body = isset($body) ? $body : (isset($text_body) ? $text_body : '');
     $i = 1;
     // порядковый номер файла
     //добавляем файлы прикрепленные файлы
     if (isset($data['attachment']) & !empty($data['attachment'])) {
         foreach ($data['attachment'] as $k => $item) {
             if (isset($item['binary']) & !empty($item['binary'])) {
                 $mail->AddStringAttachment($item["binary"], isset($item["name"]) & !empty($item["name"]) ? $item["name"] : 'file' . $i, $smtp['encoding']);
                 $i++;
             } elseif (isset($item['path']) & !empty($item['path'])) {
                 $mail->AddAttachment($item["path"], isset($item["name"]) & !empty($item["name"]) ? $item["name"] : 'file' . $i, $smtp['encoding']);
                 $i++;
             }
         }
     }
     // добавляем файлы, отображаемые на странице
     if (isset($data['embedded']) & !empty($data['embedded'])) {
         foreach ($data['embedded'] as $k => $item) {
             if (isset($item['path']) & !empty($item['path'])) {
                 $mail->AddEmbeddedImage($item["path"], isset($item["cid"]) & !empty($item["cid"]) ? $item["cid"] : $i, isset($item["name"]) & !empty($item["name"]) ? $item["name"] : 'file' . $i, $smtp['encoding']);
                 $i++;
             }
         }
     }
     //pr($mail);
     //на данном этапе имеется уже собранное письмо и нам необходимо определить mx серверы для отправки...для каждого письма.
     //чтобы повторно не искать серверы в момент отправки для каждого...
     //сохраняем для каждого домена один и тот же сервер
     $mxsrvs = array();
     $mxemails = array();
     $debug['ctime'] = round((array_sum(explode(' ', microtime())) - $stime) * 1000, 2) . " ms";
     foreach ($data['to'] as $email => $name) {
         //берем чисто host
         if (!$this->_is_valid_email($email)) {
             $debug['emails'][$email]['error'] = "неправильно указан email адрес.";
             continue;
         }
         $host = substr($email, strpos($email, "@") + 1);
         $domains = explode(".", $host);
         foreach ($domains as $level => $domain) {
             $address = implode(".", $domains);
             if (!key_exists($address, $mxsrvs)) {
                 $time = array_sum(explode(' ', microtime()));
                 if (getmxrr_portable($address, $mxhosts, $preference) == true) {
                     array_multisort($preference, $mxhosts);
                 }
                 $debug['emails'][$email]['mxtime'] = round((array_sum(explode(' ', microtime())) - $time) * 1000, 2) . " ms";
                 if (!empty($mxhosts)) {
                     $mxhosts[] = $smtp['host'];
                     //потому что shadow тормознутый сервак
                     if (in_array('shadow.rusoft.ru', $mxhosts)) {
                         unset($mxhosts[0]);
                     }
                     //чтобы включить рассылку на smtp серверы получателей, необходимо закоментировать следующую строчку
                     $mxhosts = array_reverse($mxhosts);
                     $mxsrvs[$address] = $mxhosts;
                     $mxemails[$email] =& $mxsrvs[$address];
                     $debug['emails'][$email]['mxsrvs'] =& $mxsrvs[$address];
                     break;
                 } else {
                     unset($domains[$level]);
                 }
             } else {
                 $debug['emails'][$email]['mxtime'] = 'cache(0 ms)';
                 $mxemails[$email] =& $mxsrvs[$address];
                 $debug['emails'][$email]['mxsrvs'] =& $mxsrvs[$address];
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:romlg,项目名称:cms36,代码行数:101,代码来源:sender.php

示例3: while

 if (!($dir = opendir("admin/templates/" . $template . "/images/"))) {
     echo "Error : Unable to access the templates directory !!!</body></html>";
     return;
 }
 while ($name = readdir($dir)) {
     if ($name == "." || $name == "..") {
         continue;
     }
     if (is_file("admin/templates/" . $template . "/images/" . $name)) {
         $ext = array();
         $ext = explode(".", $name, strlen($name));
         $extn = $ext[count($ext) - 1];
         if (strtolower($extn) == "gif") {
             if ($email_images == "yes") {
                 $html = str_replace("images/" . $name, "cid:" . md5($name), $html);
                 $mail->AddEmbeddedImage("admin/templates/" . $template . "/images/" . $name, md5($name), '', 'base64', "image/gif");
             } else {
                 $html = str_replace("images/" . $name, $website . $main_dir . "admin/templates/" . $template . "/images/" . $name, $html);
             }
         }
         if (strtolower($extn) == "jpg") {
             if ($email_images == "yes") {
                 $html = str_replace("images/" . $name, "cid:" . md5($name), $html);
                 $mail->AddEmbeddedImage("admin/templates/" . $template . "/images/" . $name, md5($name), '', 'base64', "image/jpeg");
             } else {
                 $html = str_replace("images/" . $name, $website . $main_dir . "admin/templates/" . $template . "/images/" . $name, $html);
             }
         }
         if (strtolower($extn) == "png") {
             if ($email_images == "yes") {
                 $html = str_replace("images/" . $name, "cid:" . md5($name), $html);
开发者ID:ahjo,项目名称:my-test-project,代码行数:31,代码来源:send50.php

示例4: Send


//.........这里部分代码省略.........
     } else {
         $y = 1;
     }
     // si se deseára configurar los parametros de el dominio
     // y cuenta de correo default, aquí se recibirian los parámetros.
     $port = $this->port;
     $smtp_secure = $this->smtp_secure;
     $auth = $this->auth;
     $host = $this->host;
     $username = $this->username;
     $password = $this->password;
     $mail = new phpmailer();
     $mail->CharSet = 'UTF-8';
     $mail->Mailer = "smtp";
     $mail->IsSMTP();
     ini_set('max_execution_time', 600);
     $mail->SMTPAuth = true;
     // si se indica un puerto este se utilizara,
     // de lo contrario su usará el default.
     if (empty($port)) {
         $mail->Port = 465;
     } else {
         $mail->Port = $port;
     }
     // si se indica un tipo de seguridad este se utilizara,
     // de lo contrario su usará el default.
     if (empty($smtp_secure)) {
         $mail->SMTPSecure = 'ssl';
     } else {
         $mail->SMTPSecure = $smtp_secure;
     }
     // si se indica un cambio en la autenticación este se utilizara,
     // de lo contrario su usará el default.
     if (empty($auth)) {
         $mail->SMTPAuth = true;
     } else {
         $mail->SMTPAuth = $auth;
     }
     // si se indica un host este se utilizara,
     // de lo contrario su usará el default.
     if (empty($host)) {
         $mail->Host = "securemail.aplus.net";
     } else {
         $mail->Host = $host;
     }
     // si se indica un usuario este se utilizara,
     // de lo contrario su usará el default.
     if (empty($username)) {
         $mail->Username = "basededatos@globalcorporation.cc";
     } else {
         $mail->Username = $username;
     }
     // si se indica un password este se utilizara,
     // de lo contrario su usará el default.
     if (empty($password)) {
         $mail->Password = "kIU8a#4i";
     } else {
         $mail->Password = $password;
     }
     $mail->Subject = $subject;
     if ($def_from == 1) {
         $mail->SetFrom($from[1], $from[0]);
     } else {
         $mail->SetFrom('basededatos@globalcorporation.cc', 'Global Corporation');
     }
     if ($rp == 1) {
         $mail->AddReplyTo($replyto[1], $replyto[0]);
     }
     $mail->Body = " ";
     $mail->MsgHTML($body);
     if ($z == 2) {
         for ($a = 0; $a < count($attachment_r); $a++) {
             $mail->AddAttachment($attachment_r[$a], $attachment_t[$a]);
         }
     }
     if ($y == 2) {
         for ($a = 0; $a < count($embeddedimg_r); $a++) {
             $mail->AddEmbeddedImage($embeddedimg_r[$a], $embeddedimg_t[$a]);
         }
     }
     for ($i = 0; $i < count($to); $i++) {
         $a = $to[$i];
         $mail->AddAddress($a['direccion'], $a['nombre']);
     }
     for ($j = 0; $j < count($cc); $j++) {
         $a = $cc[$j];
         $mail->AddCC($a['direccion'], $a['nombre']);
     }
     for ($k = 0; $k < count($cco); $k++) {
         $a = $cco[$k];
         $mail->AddBCC($a['direccion'], $a['nombre']);
     }
     $mail->IsHTML(true);
     if ($mail->Send()) {
         return true;
     } else {
         $this->errors = "SEND_MAIL_ERROR " . $mail->ErrorInfo;
         return 0;
     }
 }
开发者ID:JesusHV,项目名称:restaurantes,代码行数:101,代码来源:Mailerclass.php

示例5: enviarMail

function enviarMail($destino, $asunto, $cuerpo)
{
    $mail = new phpmailer();
    // Introducimos la información del remitente del mensaje
    $mail->From = _FROM;
    $mail->FromName = "UNCSurveys";
    // y los destinatarios del mensaje. Podemos especificar más de un destinatario
    $mail->AddAddress($destino, "UNCSurveys");
    $mail->IsHTML(true);
    // enviar como HTML
    // Añadimos el mensaje: asunto, cuerpo del mensaje en HTML y en formato
    // solo texto
    $mail->AddEmbeddedImage('../img/logo80.png', 'logo_2u', '../img/logo80.png', 'base64', 'image/png');
    $mail->AddEmbeddedImage('../img/logo300.png', 'logo_2uP', '../img/logo300.png', 'base64', 'image/png');
    $mail->Subject = $asunto;
    $mail->Body = $cuerpo;
    //$mail->AltBody  =  "Y este es el mensaje de solo texto"; // Para los queno pueden recibir en formato HTML
    $mail->IsSMTP();
    // enviar vía SMTP
    $mail->Host = _SMTP;
    // Servidores SMTP
    $mail->SMTPAuth = true;
    // activar la identificacín SMTP
    $mail->Username = _EMAILUSR;
    // usuario SMTP
    $mail->Password = _EMAILPASS;
    // clave SMTP
    $mail->Port = _PUERTO;
    $mail->SMTPSecure = "ssl";
    //print_r($mail);
    if (!$mail->Send()) {
        echo "El mensaje no se ha podido enviar - Error: " . $mail->ErrorInfo;
        exit;
        return false;
    } else {
        return true;
    }
}
开发者ID:uncsurveysCF,项目名称:2015,代码行数:38,代码来源:utilidades.php

示例6: send


//.........这里部分代码省略.........
     //DBG::log("MailTemplate::send(): Substituted: ".var_export($arrTemplate, true));
     //echo("MailTemplate::send(): Substituted:<br /><pre>".nl2br(htmlentities(var_export($arrTemplate, true), ENT_QUOTES, CONTREXX_CHARSET))."</PRE><hr />");
     //die();//return true;
     // Use defaults for missing mandatory fields
     //        if (empty($arrTemplate['sender']))
     //            $arrTemplate['sender'] = $_CONFIG['coreAdminName'];
     if (empty($arrTemplate['from'])) {
         \DBG::log("MailTemplate::send(): INFO: Empty 'from:', falling back to config");
         $arrTemplate['from'] = $_CONFIG['coreAdminEmail'];
     }
     if (empty($arrTemplate['to'])) {
         \DBG::log("MailTemplate::send(): INFO: Empty 'to:', falling back to config");
         $arrTemplate['to'] = $_CONFIG['coreAdminEmail'];
     }
     //        if (empty($arrTemplate['subject']))
     //            $arrTemplate['subject'] = $_CORELANG['TXT_CORE_MAILTEMPLATE_NO_SUBJECT'];
     //        if (empty($arrTemplate['message']))
     //            $arrTemplate['message'] = $_CORELANG['TXT_CORE_MAILTEMPLATE_NO_MESSAGE'];
     $objMail->FromName = $arrTemplate['sender'];
     $objMail->From = $arrTemplate['from'];
     $objMail->Subject = $arrTemplate['subject'];
     $objMail->CharSet = CONTREXX_CHARSET;
     //        $objMail->IsHTML(false);
     if ($arrTemplate['html']) {
         $objMail->IsHTML(true);
         $objMail->Body = $arrTemplate['message_html'];
         $objMail->AltBody = $arrTemplate['message'];
     } else {
         $objMail->Body = $arrTemplate['message'];
     }
     foreach (preg_split('/\\s*,\\s*/', $arrTemplate['reply'], null, PREG_SPLIT_NO_EMPTY) as $address) {
         $objMail->AddReplyTo($address);
     }
     //        foreach (preg_split('/\s*,\s*/', $arrTemplate['to'], null, PREG_SPLIT_NO_EMPTY) as $address) {
     //            $objMail->AddAddress($address);
     //        }
     foreach (preg_split('/\\s*,\\s*/', $arrTemplate['cc'], null, PREG_SPLIT_NO_EMPTY) as $address) {
         $objMail->AddCC($address);
     }
     foreach (preg_split('/\\s*,\\s*/', $arrTemplate['bcc'], null, PREG_SPLIT_NO_EMPTY) as $address) {
         $objMail->AddBCC($address);
     }
     // Applicable to attachments stored with the MailTemplate only!
     $arrTemplate['attachments'] = self::attachmentsToArray($arrTemplate['attachments']);
     //DBG::log("MailTemplate::send(): Template Attachments: ".var_export($arrTemplate['attachments'], true));
     // Now the MailTemplates' attachments index is guaranteed to
     // contain an array.
     // Add attachments from the parameter array, if any.
     if (isset($arrField['attachments']) && is_array($arrField['attachments'])) {
         foreach ($arrField['attachments'] as $path => $name) {
             //                if (empty($path)) $path = $name;
             //                if (empty($name)) $name = basename($path);
             $arrTemplate['attachments'][$path] = $name;
             //DBG::log("MailTemplate::send(): Added Field Attachment: $path / $name");
         }
     }
     //DBG::log("MailTemplate::send(): All Attachments: ".var_export($arrTemplate['attachments'], true));
     foreach ($arrTemplate['attachments'] as $path => $name) {
         if (is_numeric($path)) {
             $path = $name;
         }
         $objMail->AddAttachment(ASCMS_DOCUMENT_ROOT . '/' . $path, $name);
     }
     $arrTemplate['inline'] = self::attachmentsToArray($arrTemplate['inline']);
     if ($arrTemplate['inline']) {
         $arrTemplate['html'] = true;
     }
     foreach ($arrTemplate['inline'] as $path => $name) {
         if (is_numeric($path)) {
             $path = $name;
         }
         $objMail->AddEmbeddedImage(ASCMS_DOCUMENT_ROOT . '/' . $path, uniqid(), $name);
     }
     if (isset($arrField['inline']) && is_array($arrField['inline'])) {
         $arrTemplate['html'] = true;
         foreach ($arrField['inline'] as $path => $name) {
             if (is_numeric($path)) {
                 $path = $name;
             }
             $objMail->AddEmbeddedImage(ASCMS_DOCUMENT_ROOT . '/' . $path, uniqid(), $name);
         }
     }
     //die("MailTemplate::send(): Attachments and inlines<br />".var_export($objMail, true));
     $objMail->CharSet = CONTREXX_CHARSET;
     $objMail->IsHTML($arrTemplate['html']);
     //DBG::log("MailTemplate::send(): Sending: ".nl2br(htmlentities(var_export($objMail, true), ENT_QUOTES, CONTREXX_CHARSET))."<br />Sending...<hr />");
     $result = true;
     foreach (preg_split('/\\s*;\\s*/', $arrTemplate['to'], null, PREG_SPLIT_NO_EMPTY) as $addresses) {
         $objMail->ClearAddresses();
         foreach (preg_split('/\\s*[,]\\s*/', $addresses, null, PREG_SPLIT_NO_EMPTY) as $address) {
             $objMail->AddAddress($address);
         }
         //DBG::log("MailTemplate::send(): ".var_export($objMail, true));
         // TODO: Comment for test only!
         $result &= $objMail->Send();
         // TODO: $objMail->Send() seems to sometimes return true on localhost where
         // sending the mail is actually impossible.  Dunno why.
     }
     return $result;
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:101,代码来源:MailTemplate.class.php


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