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


PHP phpmailer::ClearAttachments方法代码示例

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


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

示例1: envmail

function envmail($email, $subject, $msg, $from, $fromname = "Opala Clube Franca")
{
    require_once "class.phpmailer.php";
    $mail = new phpmailer();
    $mail->ClearAddresses();
    $mail->ClearAllRecipients();
    $mail->ClearAddresses();
    $mail->ClearCustomHeaders();
    $mail->IsSMTP();
    //    $mail->IsSendmail();
    $mail->From = $from;
    $mail->FromName = $fromname;
    // 	$mail->Hostname = "smtp.gmail.com";
    //	$mail->Host     = "smtp.gmail.com";
    $mail->SMTPSecure = "ssl";
    $mail->Hostname = "smtp.opalaclubefranca.com.br";
    $mail->Host = "smtp.opalaclubefranca.com.br";
    //    $mail->SMTPDebug = 2;
    $mail->Username = "admin@opalaclubefranca.com.br";
    $mail->Password = "racnela";
    $mail->SMTPAuth = true;
    $mail->Port = 465;
    $mail->Timeout = 120;
    $body = $msg;
    $text_body = $msg;
    $mail->isHTML(true);
    $mail->Subject = $subject;
    $mail->Body = $body;
    $mail->AltBody = $text_body;
    if (is_array($email)) {
        foreach ($email as $em) {
            $mail->AddAddress($em, "");
        }
    } else {
        $mail->AddAddress($email, "");
    }
    /*  echo '<tr><td>To '.$email.'</td></tr>'."\n";
        echo '<tr><td>Assunto '.$subject.'</td></tr>'."\n";
        echo '<tr><td>Mensagem '.$msg.'</td></tr>'."\n";
        echo '<tr><td>From '.$from.'</td></tr>'."\n";
    */
    $exito = $mail->Send();
    $v = 0;
    //    echo "<tr><td>ErrorInfo " . $mail->ErrorInfo . "<br></td></tr>";
    while (!$exito && $v < 5 && $mail->ErrorInfo != "SMTP Error: Data not accepted.") {
        sleep(2);
        $exito = $mail->Send();
        echo "<tr><td>ErrorInfo " . $mail->ErrorInfo . "<br></td></tr>";
        $v = $v + 1;
    }
    if (!$exito) {
        echo "<tr><td>There has been a mail error sending to " . $mail->ErrorInfo . "<br></td></tr>";
    }
    $mail->ClearAddresses();
    $mail->ClearAttachments();
    return $mail->ErrorInfo;
}
开发者ID:alencarmo,项目名称:OCF,代码行数:57,代码来源:envmail.php

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

示例3: emailSend


//.........这里部分代码省略.........
             } 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];
             }
         }
     }
     //получены все mx северы и теперь начинаем отправку по списку
     foreach ($mxemails as $email => $mxs) {
         //проверяем email адрес на существование и работу mx сервера
         //можно включить проверку, но это 1) замедляет, 2) вероятность очень низкая
         //$this->checkEmail($email, $mxs, $debug);
         $mail->AddAddress($email, $name);
         foreach ($mxs as $k => $host) {
             $mail->Host = $host;
             $time = array_sum(explode(' ', microtime()));
             $status = $mail->Send();
             $debug['emails'][$email]['sendtime'] = round((array_sum(explode(' ', microtime())) - $time) * 1000, 2) . " ms";
             $debug['emails'][$email]['status'] = $status;
             if ($status) {
                 $debug['emails'][$email]['host'] = $host;
                 break;
             }
         }
         $mail->ClearAddresses();
     }
     $debug['time'] = round((array_sum(explode(' ', microtime())) - $stime) * 1000, 2) . " ms";
     if (function_exists('log_notice')) {
         //скидываем в лог информацию о отправленных сообщениях
         $str = "<b>Были отправлены следующие сообщения:</b><br>Время генерации шалона для отправки:&nbsp" . $debug['ctime'] . "<br>Общее время:&nbsp" . $debug['time'] . "<br><b>Адреса:</b><br>";
         foreach ($debug['emails'] as $k => $v) {
             $str .= "<br>&nbsp;&nbsp;&nbsp;<b><font color='blue'>" . $k . "</font></b>";
             $str .= "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Определение smtp серверов:&nbsp" . $v['mxtime'];
             $str .= "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Отправлено через: " . $v['host'];
             $str .= "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Время отправления: " . $v['sendtime'];
             $str .= "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Статус: " . ($v['status'] ? '<font color="green">успешно</font>' : '<font color="red">неудачно</font>');
         }
         log_notice('email', false, $str);
     }
     //$status = true;
     // Clear attachments for next loop
     $mail->ClearAttachments();
     if ($status) {
         return true;
     }
     return false;
 }
开发者ID:romlg,项目名称:cms36,代码行数:101,代码来源:sender.php

示例4:

     $mail->From = $_POST['sender_email'];
     $mail->FromName = $_POST['sender_email'];
     $mail->Mailer = "smtp";
     $mail->Host = $smtp_mailhost;
     $mail->SMTPAuth = true;
     $mail->Username = $smtp_user;
     $mail->Password = $smtp_pw;
     $mail->Subject = "EMail vom " . $shopconfig['shopconfig_pagetitle'] . " Gästebuch";
     $body = "Hallo " . $_POST['myname'] . ",\nvielen Dank für den Eintrag in unserem Gästebuch,\nName: " . $_POST['myname'] . "\nDatum: " . $datum . "\nEmail: " . $_POST['myemail'] . "\nHomepage: " . $_POST['myhp'] . "\nKommentar: " . $_POST['mymassage'] . "\nText: " . $_POST['text'] . "\n\nDas {$pagename} |" . $mandant['name'] . " Team";
     $mail->Body = $body;
     $mail->AltBody = $body;
     $mail->AddAddress($_POST['myemail'], $_POST['myname']);
     $mail->AddCC($mandant['mandant_email'], $mandant['mandant_vorname'] . " " . $mandant['mandant_nachname']);
     @$mail->Send();
     $mail->ClearAddresses();
     $mail->ClearAttachments();
 } else {
     print $fehler;
     if ($fehler == 1) {
         $smarty->assign("fehler", 1);
     }
     if ($fehler == 2) {
         $smarty->assign("fehler", $fehler);
     }
     $_GET['neu'] = 1;
     $smarty->assign("myname", $_POST['myname']);
     $smarty->assign("mymassage", $_POST['mymassage']);
     $smarty->assign("myemail", $_POST['myemail']);
     $smarty->assign("myhp", $_POST['myhp']);
     $smarty->assign("myicq", $_POST['myicq']);
     $smarty->assign("myaim", $_POST['myaim']);
开发者ID:BackupTheBerlios,项目名称:rescuedogportal-svn,代码行数:31,代码来源:community.php

示例5: SendEmail


//.........这里部分代码省略.........
     }
     if ($mail->Send()) {
         // && $UserID == 0) {
         $ReturnVar = $count++;
         if ($TmpEntry == 1) {
             // Insert TMP-ENTRY Sended Email & Count++
             $query = "UPDATE " . DBPREFIX . "module_newsletter_tmp_sending SET sendt=1 where email='" . $TargetEmail . "' AND newsletter=" . $NewsletterID . "";
             if ($objDatabase->Execute($query) === false) {
                 if ($_DBCONFIG['dbType'] == 'mysql' && $objDatabase->ErrorNo() == 2006) {
                     @$objDatabase->Connect($_DBCONFIG['host'], $_DBCONFIG['user'], $_DBCONFIG['password'], $_DBCONFIG['database'], true);
                     if ($objDatabase->Execute($query) === false) {
                         return false;
                     }
                 }
             }
             $objDatabase->Execute("\n                    UPDATE " . DBPREFIX . "module_newsletter\n                       SET count=count+1\n                     WHERE id={$NewsletterID}");
             $queryCheck = "SELECT 1 FROM " . DBPREFIX . "module_newsletter_tmp_sending where newsletter=" . $NewsletterID . " and sendt=0";
             $objResultCheck = $objDatabase->SelectLimit($queryCheck, 1);
             if ($objResultCheck->RecordCount() == 0) {
                 $objDatabase->Execute("\n                        UPDATE " . DBPREFIX . "module_newsletter\n                           SET status=1\n                         WHERE id={$NewsletterID}");
             }
         }
         /*elseif ($mail->error_count) {
               if (strstr($mail->ErrorInfo, 'authenticate')) {
                   self::$strErrMessage .= sprintf($_ARRAYLANG['TXT_NEWSLETTER_MAIL_AUTH_FAILED'], htmlentities($arrSmtp['name'], ENT_QUOTES, CONTREXX_CHARSET)).'<br />';
                   $ReturnVar = false;
               }
           } */
     } else {
         $performRejectedMailOperation = false;
         if (strstr($mail->ErrorInfo, 'authenticate')) {
             // -> smtp error
             self::$strErrMessage .= sprintf($_ARRAYLANG['TXT_NEWSLETTER_MAIL_AUTH_FAILED'], htmlentities($arrSmtp['name'], ENT_QUOTES, CONTREXX_CHARSET)) . '<br />';
         } elseif (strstr($mail->ErrorInfo, 'from_failed')) {
             // -> mail error
             self::$strErrMessage .= sprintf($_ARRAYLANG['TXT_NEWSLETTER_FROM_ADDR_REJECTED'], htmlentities($sender_email, ENT_QUOTES, CONTREXX_CHARSET)) . '<br />';
         } elseif (strstr($mail->ErrorInfo, 'recipients_failed')) {
             // -> recipient error
             $performRejectedMailOperation = true;
             self::$strErrMessage .= sprintf($_ARRAYLANG['TXT_NEWSLETTER_RECIPIENT_FAILED'], htmlentities($TargetEmail, ENT_QUOTES, CONTREXX_CHARSET)) . '<br />';
         } elseif (strstr($mail->ErrorInfo, 'instantiate')) {
             // -> php error
             self::$strErrMessage .= $_ARRAYLANG['TXT_NEWSLETTER_LOCAL_SMTP_FAILED'] . '<br />';
         } elseif (strstr($mail->ErrorInfo, 'connect_host')) {
             // -> smtp error
             self::$strErrMessage .= $_ARRAYLANG['TXT_NEWSLETTER_CONNECT_SMTP_FAILED'] . '<br />';
         } else {
             // -> mail error
             self::$strErrMessage .= $mail->ErrorInfo . '<br />';
         }
         $ReturnVar = false;
         if ($TmpEntry == 1) {
             $arrSettings = $this->_getSettings();
             if ($performRejectedMailOperation && $arrSettings['rejected_mail_operation']['setvalue'] != 'ignore') {
                 switch ($arrSettings['rejected_mail_operation']['setvalue']) {
                     case 'deactivate':
                         // Remove temporary data from the module
                         if ($objDatabase->Execute("DELETE FROM `" . DBPREFIX . "module_newsletter_tmp_sending` WHERE `email` ='" . addslashes($TargetEmail) . "'") !== false) {
                             switch ($type) {
                                 case self::USER_TYPE_CORE:
                                     // do nothing with system users
                                     break;
                                 case self::USER_TYPE_ACCESS:
                                     // TODO: Remove newsletter subscription for access_user
                                     break;
                                 case self::USER_TYPE_NEWSLETTER:
                                 default:
                                     // Deactivate user
                                     $objDatabase->Execute("UPDATE `" . DBPREFIX . "module_newsletter_user` SET `status` = 0 WHERE `id` = " . $UserID);
                                     break;
                             }
                         }
                         break;
                     case 'delete':
                         switch ($type) {
                             case self::USER_TYPE_CORE:
                                 // do nothing with system users
                                 break;
                             case self::USER_TYPE_ACCESS:
                                 // TODO: Remove newsletter subscription for access_user
                                 break;
                             case self::USER_TYPE_NEWSLETTER:
                             default:
                                 // Remove user data from the module
                                 $this->_deleteRecipient($UserID);
                                 break;
                         }
                         break;
                     case 'inform':
                         $this->informAdminAboutRejectedMail($NewsletterID, $UserID, $TargetEmail, $type, $newsletterUserData);
                         break;
                 }
             }
             $ReturnVar = $count;
         }
     }
     $mail->ClearAddresses();
     $mail->ClearAttachments();
     return $ReturnVar;
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:101,代码来源:NewsletterManager.class.php

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

示例7: strftime

     if ($mail_send_to['admin_gender'] == 'm') {
         $body = EMAIL_GREET_MR . $mail_send_to['admin_lastname'] . ',' . "\n\n";
     } else {
         $body = EMAIL_GREET_MS . $mail_send_to['admin_lastname'] . ',' . "\n\n";
     }
     $body .= EMAIL_CVS_INTRO . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
     $body .= EMAIL_FTP_INFO . "\n";
     $body .= '         ' . $db_table_file . "\n\n";
     $body .= EMAIL_FOOT;
     $send_mail->Body = $body;
     $send_mail->AddAddress($mail_send_to['admin_email_address'], $mail_send_to['admin_firstname'] . ' ' . $mail_send_to['admin_lastname']);
     $send_mail->AddAttachment(OWP_CSV_TEMP . $db_table_file);
     $send_mail->Send();
     // Clear all addresses and attachments for next loop
     $send_mail->ClearAddresses();
     $send_mail->ClearAttachments();
     $messageStack->add_session(sprintf(SUCCESS_CVS_COUNTRIES_SENT, $mail_send_to['admin_email_address']), 'notice');
 }
 // download
 if (CVS_DOWNLOAD == 'true') {
     $fp = fopen(OWP_CSV_TEMP . $db_table_file, 'r');
     $buffer = fread($fp, filesize(OWP_CSV_TEMP . $db_table_file));
     fclose($fp);
     if (CVS_DELETE_FILE == 'true' && CVS_SEND_MAIL == 'false') {
         @unlink(OWP_CSV_TEMP . $db_table_file);
     }
     header('Content-Type: application/vnd.ms-excel');
     header('Content-Disposition: attachment; filename="' . $db_table_file . '"');
     header('Expires: 0');
     header('Pragma: no-cache');
     echo $buffer;
开发者ID:BackupTheBerlios,项目名称:osiswebprinter,代码行数:31,代码来源:countries.php

示例8: sendEmail

 function sendEmail($recipient_address, $recipient_name, $subject, $message)
 {
     ## The php builtin mailing functions do not work all the time so I have
     ## selected to use phpMailer (phpmailer.sourceforge.net/)
     $mail = new phpmailer();
     $mail->From = $this->_adminEmail;
     $mail->FromName = $this->_adminName;
     $mail->Host = $this->_emailHosts;
     $mail->Mailer = "smtp";
     $mail->Subject = $subject;
     $mail->Body = $message;
     $mail->AddAddress($recipient_address, $recipient_name);
     if (!$mail->Send()) {
         echo $this->_('There has been a mail error sending to ' . $recipient_address . " " . $mail->ErrorInfo . "<br />");
         return false;
     }
     // Clear all addresses and attachments for next loop
     $mail->ClearAddresses();
     $mail->ClearAttachments();
     return true;
 }
开发者ID:pjflameboy,项目名称:phprecipebook,代码行数:21,代码来源:phpSM.class.php


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