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


PHP PHPMailer::clearAttachments方法代码示例

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


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

示例1: 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('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:kirkbauer2,项目名称:kirkxc,代码行数:33,代码来源:Mailer.php

示例2: send

 /**
  * @param bool $immediately
  * @return bool
  * @throws \phpmailerException
  */
 public function send($immediately = true)
 {
     $salida = $this->mail->Send();
     $this->mail->clearAddresses();
     $this->mail->clearAttachments();
     return $salida;
 }
开发者ID:buuum,项目名称:mail,代码行数:12,代码来源:PhpMailerHandler.php

示例3: testMiscellaneous

 /**
  * Miscellaneous calls to improve test coverage and some small tests.
  */
 public function testMiscellaneous()
 {
     $this->assertEquals('application/pdf', PHPMailer::_mime_types('pdf'), 'MIME TYPE lookup failed');
     $this->Mail->addCustomHeader('SomeHeader: Some Value');
     $this->Mail->clearCustomHeaders();
     $this->Mail->clearAttachments();
     $this->Mail->isHTML(false);
     $this->Mail->isSMTP();
     $this->Mail->isMail();
     $this->Mail->isSendmail();
     $this->Mail->isQmail();
     $this->Mail->setLanguage('fr');
     $this->Mail->Sender = '';
     $this->Mail->createHeader();
     $this->assertFalse($this->Mail->set('x', 'y'), 'Invalid property set succeeded');
     $this->assertTrue($this->Mail->set('Timeout', 11), 'Valid property set failed');
     $this->assertTrue($this->Mail->set('AllowEmpty', null), 'Null property set failed');
     $this->assertTrue($this->Mail->set('AllowEmpty', false), 'Valid property set of null property failed');
     //Test pathinfo
     $a = '/mnt/files/飛兒樂 團光茫.mp3';
     $q = PHPMailer::mb_pathinfo($a);
     $this->assertEquals($q['dirname'], '/mnt/files', 'UNIX dirname not matched');
     $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'UNIX basename not matched');
     $this->assertEquals($q['extension'], 'mp3', 'UNIX extension not matched');
     $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'UNIX filename not matched');
     $this->assertEquals(PHPMailer::mb_pathinfo($a, PATHINFO_DIRNAME), '/mnt/files', 'Dirname path element not matched');
     $this->assertEquals(PHPMailer::mb_pathinfo($a, PATHINFO_BASENAME), '飛兒樂 團光茫.mp3', 'Basename path element not matched');
     $this->assertEquals(PHPMailer::mb_pathinfo($a, 'filename'), '飛兒樂 團光茫', 'Filename path element not matched');
     $a = 'c:\\mnt\\files\\飛兒樂 團光茫.mp3';
     $q = PHPMailer::mb_pathinfo($a);
     $this->assertEquals($q['dirname'], 'c:\\mnt\\files', 'Windows dirname not matched');
     $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'Windows basename not matched');
     $this->assertEquals($q['extension'], 'mp3', 'Windows extension not matched');
     $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'Windows filename not matched');
     $this->assertEquals(PHPMailer::filenameToType('abc.jpg?xyz=1'), 'image/jpeg', 'Query string not ignored in filename');
     $this->assertEquals(PHPMailer::filenameToType('abc.xyzpdq'), 'application/octet-stream', 'Default MIME type not applied to unknown extension');
     //Line break normalization
     $eol = $this->Mail->LE;
     $b1 = "1\r2\r3\r";
     $b2 = "1\n2\n3\n";
     $b3 = "1\r\n2\r3\n";
     $this->Mail->LE = "\n";
     $t1 = "1{$this->Mail->LE}2{$this->Mail->LE}3{$this->Mail->LE}";
     $this->assertEquals($this->Mail->fixEOL($b1), $t1, 'Failed to normalize line breaks (1)');
     $this->assertEquals($this->Mail->fixEOL($b2), $t1, 'Failed to normalize line breaks (2)');
     $this->assertEquals($this->Mail->fixEOL($b3), $t1, 'Failed to normalize line breaks (3)');
     $this->Mail->LE = "\r\n";
     $t1 = "1{$this->Mail->LE}2{$this->Mail->LE}3{$this->Mail->LE}";
     $this->assertEquals($this->Mail->fixEOL($b1), $t1, 'Failed to normalize line breaks (4)');
     $this->assertEquals($this->Mail->fixEOL($b2), $t1, 'Failed to normalize line breaks (5)');
     $this->assertEquals($this->Mail->fixEOL($b3), $t1, 'Failed to normalize line breaks (6)');
     $this->Mail->LE = $eol;
 }
开发者ID:jbs321,项目名称:portfolio,代码行数:56,代码来源:phpmailerTest.php

示例4: reset

 /**
  * Resets the currently set mailer values back to there default values
  *
  * @return $this
  */
 public function reset()
 {
     $this->subject = '';
     $this->body = '';
     $this->htmlBody = '';
     $this->urlWeb = '';
     $this->mailSignature = '';
     $this->from = '';
     $this->recipients = null;
     $this->bcc = false;
     $this->attachments = [];
     $this->template = '';
     if ($this->phpMailer) {
         $this->phpMailer->clearAllRecipients();
         $this->phpMailer->clearAttachments();
     }
     return $this;
 }
开发者ID:acp3,项目名称:core,代码行数:23,代码来源:Mailer.php

示例5: save_lead


//.........这里部分代码省略.........
																width:90%;
																margin:auto;
																padding:2%;
																border-radius:10px;
															}
															#submission_info table, #submission_info tr,#submission_info td {
																margin:auto;
																color:#000;
															}
															a {
																//color:#FE3F44;
																color:#303030;
															}
															#email_photo {
															max-width:500px;
															margin:1% 0 3% 0;
															box-shadow:0px 0px 5px #303030;
														}
														#signature_block {
														margin: 4% auto;
														font-size:80%;

													}
												</style>
												<body>
													<img style="width:250px" src="http://freelabel.net/images/FREELABELLOGO.gif"><br>
													<img style="width:250px" src="http://freelabel.net/images/flheadblack.png"><br>

													<div id="para_text">
														<h1>' . $email_subject . '</h1>

														' . $email_body . "\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<hr>\n\t\t\t\t\t\t\t\t\t\t\t\t" . '<h2>LEAD INFORMATION:</h2>
														<div id="submission_info">
															<table>
																<tr>
																	<td>COMMENTS:</td>
																	<td>' . $lead_name . '</td>
																</tr>
																<tr>
																	<td>PHONE:</td>
																	<td>' . $lead_phone . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>FOLLOW UP // ENTRY DATE:</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $follow_up_date . " // " . $entry_date . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>TWITTER:</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $lead_twitter . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>EMAIL:</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $lead_email . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br><br>\n\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div id='signature_block'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<u>FREELABEL Account Executive</u>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<br>c: (323) 601-8111<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\te: info@FREELABEL.net\n\n\n\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\nFREELABEL.net\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t</body>";
            $stafflist = array('notifications@freelabel.net', 'sales@freelabel.net', 'request.chiffon@gmail.com');
            //foreach ($stafflist as $admin) {
            include '../../../mailer/PHPMailerAutoload.php';
            //Create a new PHPMailer instance
            $mail = new PHPMailer();
            // Set PHPMailer to use the sendmail transport
            $mail->isSendmail();
            //Set who the message is to be sent from
            $mail->setFrom('admin@freelabel.net', 'FL SALES');
            //Set an alternative reply-to address
            $mail->addReplyTo('admin@freelabel.net', 'Sales Administration');
            //Set the subject line
            $mail->Subject = $email_subject;
            //Read an HTML message body from an external file, convert referenced images to embedded,
            //convert HTML into a basic plain-text alternative body
            $mail->msgHTML($body_template);
            //Replace the plain text body with one created manually
            $mail->AltBody = $body_template;
            //Attach an image file
            //$mail->addAttachment('images/phpmailer_mini.png');
            //send the message, check for errors
            foreach ($stafflist as $admin) {
                //This iterator syntax only works in PHP 5.4+
                $mail->addAddress($admin, 'FREELABEL SUBMISSIONS');
                if (!empty($row['photo'])) {
                    $mail->addStringAttachment($row['photo'], 'YourPhoto.jpg');
                    //Assumes the image data is stored in the DB
                }
                if (!$mail->send()) {
                    echo "Mailer Error (" . str_replace("@", "&#64;", $admin) . ') ' . $mail->ErrorInfo . '<br />';
                    break;
                    //Abandon sending
                } else {
                    echo "Message sent to: " . $admin . "!<br>";
                    //echo "<br><br><br><br>".$body_template.'<br><br>';
                    echo "Message sent to :" . $admin . ' (' . str_replace("@", "&#64;", $admin) . ')<br />';
                }
                // Clear all addresses and attachments for next loop
                $mail->clearAddresses();
                $mail->clearAttachments();
            }
            echo "Entry Created Successfully! ";
            echo "<script>\n\t\t\t\t\t\t\t\t\t\t\tfunction newDoc()\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\twindow.location.assign(\"http://freelabel.net/?ctrl=leads#add\")\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tnewDoc()\n\t\t\t\t\t\t\t\t\t\t\t</script>";
            echo '<style>
					html {
					color:#fff;
					background-color:#303030;
					margin:10%;
					font-size:300%;
					font-family:sans-serif;
					}
					</style>';
            echo "Your LEAD has been Saved. Please stay updated!<br><br>Your Lead: <p id='sub_label' >" . $lead_name . '<br>TWITTER: ';
            echo $lead_twitter . " and you must follow up on: " . $follow_up_date . "</p><a href='http://freelabel.net/submit/#leads'>Return to Dashboard</a><br><br><br><br><br><br>";
        } else {
            echo "Error creating database entry: " . mysqli_error($con);
        }
    }
}
开发者ID:mayoalexander,项目名称:fl-two,代码行数:101,代码来源:lead_conversion.php

示例6: bp_email

 /**
  * Send email(s).
  *
  * @since 2.5.0
  *
  * @param BP_Email $email Email to send.
  * @return bool|WP_Error Returns true if email send, else a descriptive WP_Error.
  */
 public function bp_email(BP_Email $email)
 {
     static $phpmailer = null;
     if ($phpmailer === null) {
         if (!class_exists('PHPMailer')) {
             require_once ABSPATH . WPINC . '/class-phpmailer.php';
             require_once ABSPATH . WPINC . '/class-smtp.php';
         }
         $phpmailer = new PHPMailer(true);
     }
     /*
      * Resets.
      */
     $phpmailer->clearAllRecipients();
     $phpmailer->clearAttachments();
     $phpmailer->clearCustomHeaders();
     $phpmailer->clearReplyTos();
     $phpmailer->Sender = '';
     /*
      * Set up.
      */
     $phpmailer->IsMail();
     $phpmailer->CharSet = bp_get_option('blog_charset');
     $phpmailer->Hostname = self::get_hostname();
     /*
      * Content.
      */
     $phpmailer->Subject = $email->get_subject('replace-tokens');
     $content_plaintext = PHPMailer::normalizeBreaks($email->get_content_plaintext('replace-tokens'));
     if ($email->get('content_type') === 'html') {
         $phpmailer->msgHTML($email->get_template('add-content'), '', 'wp_strip_all_tags');
         $phpmailer->AltBody = $content_plaintext;
     } else {
         $phpmailer->IsHTML(false);
         $phpmailer->Body = $content_plaintext;
     }
     $recipient = $email->get_from();
     try {
         $phpmailer->SetFrom($recipient->get_address(), $recipient->get_name(), false);
     } catch (phpmailerException $e) {
     }
     $recipient = $email->get_reply_to();
     try {
         $phpmailer->addReplyTo($recipient->get_address(), $recipient->get_name());
     } catch (phpmailerException $e) {
     }
     $recipients = $email->get_to();
     foreach ($recipients as $recipient) {
         try {
             $phpmailer->AddAddress($recipient->get_address(), $recipient->get_name());
         } catch (phpmailerException $e) {
         }
     }
     $recipients = $email->get_cc();
     foreach ($recipients as $recipient) {
         try {
             $phpmailer->AddCc($recipient->get_address(), $recipient->get_name());
         } catch (phpmailerException $e) {
         }
     }
     $recipients = $email->get_bcc();
     foreach ($recipients as $recipient) {
         try {
             $phpmailer->AddBcc($recipient->get_address(), $recipient->get_name());
         } catch (phpmailerException $e) {
         }
     }
     $headers = $email->get_headers();
     foreach ($headers as $name => $content) {
         $phpmailer->AddCustomHeader($name, $content);
     }
     /**
      * Fires after PHPMailer is initialised.
      *
      * @since 2.5.0
      *
      * @param PHPMailer $phpmailer The PHPMailer instance.
      */
     do_action('bp_phpmailer_init', $phpmailer);
     /** This filter is documented in wp-includes/pluggable.php */
     do_action_ref_array('phpmailer_init', array(&$phpmailer));
     try {
         return $phpmailer->Send();
     } catch (phpmailerException $e) {
         return new WP_Error($e->getCode(), $e->getMessage(), $email);
     }
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:95,代码来源:class-bp-phpmailer.php

示例7: initMailer

 /**
  * Initialisiert ein Objekt der Klasse PhpMailer und setzt die
  * Authentifizierung des Systems ein.
  * @param int $port pass a port number here
  * @param string $security an empty string or 'tls' or 'ssl'
  * @return \PHPMailer
  * @throws Exception if PHPMailer throws an exception
  */
 public static function initMailer($port = null, $security = null)
 {
     /** PhpMailer einbinden */
     require_once realpath(ROOT_PATH) . '/external_scripts/phpmailer/class.phpmailer.php';
     require_once realpath(ROOT_PATH) . "/external_scripts/phpmailer/class.smtp.php";
     $mail = new PHPMailer();
     // Vorformatierungen
     $mail->setLanguage('de');
     $mail->CharSet = 'utf-8';
     $mail->clearAttachments();
     $mail->clearAddresses();
     if (defined('SMTP_HOST') && strlen(SMTP_HOST) > 0) {
         // SMTP-Autorisierung
         $mail->isSMTP();
         $mail->Host = SMTP_HOST;
         if (defined('DEBUG_MODUS') && DEBUG_MODUS > 0) {
             $mail->SMTPDebug = 2;
         }
         if (!is_null($port)) {
             $mail->Port = $port;
         } elseif (defined('SMTP_PORT') && strlen(SMTP_PORT) > 0) {
             $mail->Port = SMTP_PORT;
         }
         if (defined('SMTP_USER') && strlen(SMTP_USER) > 0 && defined('SMTP_PASSWORD') && strlen(SMTP_PASSWORD) > 0) {
             $mail->SMTPAuth = true;
             $mail->Username = SMTP_USER;
             $mail->Password = SMTP_PASSWORD;
             if (!is_null($security)) {
                 $mail->SMTPSecure = $security;
             } elseif (defined("SMTP_SECURITY") && strlen(SMTP_SECURITY) > 0) {
                 $mail->SMTPSecure = SMTP_SECURITY;
             }
         } else {
             $mail->SMTPAuth = false;
         }
     } else {
         $mail->isSendmail();
     }
     return $mail;
 }
开发者ID:ReichardtIT,项目名称:open-letters-newsletter,代码行数:48,代码来源:newsletter.class.php

示例8: sola_nl_ajax_send


//.........这里部分代码省略.........
        $saved_send_method = get_option("sola_nl_send_method");
        if ($saved_send_method == "1") {
            $headers[] = 'From: ' . $sent_from_name . '<' . $sent_from . '>';
            $headers[] = 'Content-type: text/html';
            $headers[] = 'Reply-To: ' . $reply_name . '<' . $reply . '>';
        } else {
            if ($saved_send_method >= "2") {
                $file = PLUGIN_URL . '/includes/phpmailer/PHPMailerAutoload.php';
                require_once $file;
                $mail = new PHPMailer();
                $mail->IsSMTP();
                $mail->SMTPAuth = true;
                $mail->SMTPKeepAlive = true;
                $port = get_option("sola_nl_port");
                $encryption = get_option("sola_nl_encryption");
                if ($encryption) {
                    $mail->SMTPSecure = $encryption;
                }
                $host = get_option("sola_nl_host");
                $mail->Host = $host;
                $mail->Username = get_option("sola_nl_username");
                $mail->Password = get_option("sola_nl_password");
                $mail->Port = $port;
                $mail->AddReplyTo($reply, $reply_name);
                $mail->SetFrom($sent_from, $sent_from_name);
                $mail->Subject = $camp->subject;
                $mail->SMTPDebug = 0;
            }
        }
        if ($subscribers) {
            foreach ($subscribers as $subscriber) {
                set_time_limit(600);
                $sub_id = $subscriber['sub_id'];
                $sub_email = $subscriber['sub_email'];
                echo $sub_email;
                $body = sola_nl_mail_body($camp->email, $sub_id, $camp->camp_id);
                $sola_global_subid = $sub_id;
                $sola_global_campid = $camp->camp_id;
                $body = do_shortcode($body);
                $body = sola_nl_replace_links($body, $sub_id, $camp->camp_id);
                /* ------ */
                //$check = sola_mail($camp_id ,$sub_email, $camp->subject, $body);
                if ($saved_send_method == "1") {
                    if (wp_mail($sub_email, $camp->subject, $body, $headers)) {
                        $check = true;
                    } else {
                        if (!$debug) {
                            $check = array('error' => 'Error sending mail to' . $sub_email);
                        } else {
                            $check = array('error' => "Failed to send email to {$sub_email}... " . $GLOBALS['phpmailer']->ErrorInfo);
                        }
                    }
                } else {
                    if ($saved_send_method >= "2") {
                        if (is_array($sub_email)) {
                            foreach ($sub_email as $address) {
                                $mail->AddAddress($address);
                            }
                        } else {
                            $mail->AddAddress($sub_email);
                        }
                        $mail->Body = $body;
                        $mail->IsHTML(true);
                        //echo "sending to $sub_email<br />";
                        if (!$mail->Send()) {
                            $check = array('error' => 'Error sending mail to ' . $sub_email);
                        } else {
                            $check = true;
                        }
                    }
                }
                if ($check === true) {
                    sola_update_camp_limit($camp_id);
                    $wpdb->update($sola_nl_camp_subs_tbl, array('status' => 1), array('camp_id' => $camp_id, 'sub_id' => $sub_id), array('%d'), array('%d', '%d'));
                    //echo "Email sent to $sub_email successfully <br />";
                } else {
                    sola_return_error(new WP_Error('sola_error', __('Failed to send email to subscriber'), 'Could not send email to ' . $sub_email));
                    //echo "<p>Failed to send to ".$sub_email."</p>";
                }
                $mail->clearAddresses();
                $mail->clearAttachments();
                $end = (double) array_sum(explode(' ', microtime()));
                echo "<br />processing time: " . sprintf("%.4f", $end - $debug_start) . " seconds<br />";
                //$check = sola_nl_send_mail_via_cron($camp_id,$sub_id,$sub_email);
                //if ( is_wp_error($check)) sola_return_error($check);
            }
        } else {
            /* do nothing, reached limit */
        }
        if ($saved_send_method >= "2") {
            $mail->smtpClose();
        }
        $end = (double) array_sum(explode(' ', microtime()));
        echo "<br />processing time: " . sprintf("%.4f", $end - $debug_start) . " seconds<br />";
        update_option("sola_currently_sending", "no");
        sola_nl_done_sending_camp($camp_id);
    } else {
        echo "<br />nothing to send at this time<br />";
    }
}
开发者ID:jekv,项目名称:devia,代码行数:101,代码来源:module_sending.php

示例9: phpmailer_gmail_send

/**
 * Send an email using phpmailer
 *
 * @param string $from       From address
 * @param string $from_name  From name
 * @param string $to         To address
 * @param string $to_name    To name
 * @param string $subject    The subject of the message.
 * @param string $body       The message body
 * @param array  $bcc        Array of address strings
 * @param bool   $html       Set true for html email, also consider setting
 *                           altbody in $params array
 * @param array  $files      Array of file descriptor arrays, each file array
 *                           consists of full path and name
 * @param array  $params     Additional parameters
 * @return bool
 */
function phpmailer_gmail_send($from, $from_name, $to, $to_name, $subject, $body, array $bcc = NULL, $html = false, array $files = NULL, array $params = NULL)
{
    static $phpmailer;
    // Ensure phpmailer object exists
    if (!is_object($phpmailer) || !is_a($phpmailer, 'PHPMailer')) {
        require_once elgg_get_plugins_path() . '/phpmailer_gmail/vendors/phpmailer/PHPMailerAutoload.php';
        $phpmailer = new PHPMailer();
    }
    if (!$from) {
        throw new NotificationException(sprintf(elgg_echo('NotificationException:MissingParameter'), 'from'));
    }
    if (!$to && !$bcc) {
        throw new NotificationException(sprintf(elgg_echo('NotificationException:MissingParameter'), 'to'));
    }
    if (!$subject) {
        throw new NotificationException(sprintf(elgg_echo('NotificationException:MissingParameter'), 'subject'));
    }
    // set line ending if admin selected \n (if admin did not change setting, null is returned)
    if (elgg_get_plugin_setting('nonstd_mta', 'phpmailer')) {
        $phpmailer->LE = "\n";
    } else {
        $phpmailer->LE = "\r\n";
    }
    ////////////////////////////////////
    // Format message
    $phpmailer->clearAllRecipients();
    $phpmailer->clearAttachments();
    // Set the from name and email
    //$phpmailer->From = $from;
    //$phpmailer->FromName = $from_name;
    //Set who the message is to be sent from
    $phpmailer->setFrom($from, $from_name);
    //Set an alternative reply-to address
    $phpmailer->addReplyTo($from, $from_name);
    // Set destination address
    if (isset($to)) {
        $phpmailer->addAddress($to, $to_name);
    }
    // set bccs if exists
    if ($bcc && is_array($bcc)) {
        foreach ($bcc as $address) {
            $phpmailer->addBCC($address, $address);
        }
    }
    $phpmailer->Subject = $subject;
    if (!$html) {
        $phpmailer->CharSet = 'utf-8';
        $phpmailer->isHTML(false);
        if ($params && array_key_exists('altbody', $params)) {
            $phpmailer->AltBody = $params['altbody'];
        }
        $trans_tbl = get_html_translation_table(HTML_ENTITIES);
        $trans_tbl[chr(146)] = '&rsquo;';
        foreach ($trans_tbl as $k => $v) {
            $ttr[$v] = utf8_encode($k);
        }
        $source = strtr($body, $ttr);
        $body = strip_tags($source);
    } else {
        $phpmailer->isHTML(true);
    }
    $phpmailer->Body = $body;
    if ($files && is_array($files)) {
        foreach ($files as $file) {
            if (isset($file['path'])) {
                $phpmailer->addAttachment($file['path'], $file['name']);
            }
        }
    }
    $is_smtp = elgg_get_plugin_setting('phpmailer_gmail_smtp', 'phpmailer_gmail');
    $smtp_host = elgg_get_plugin_setting('phpmailer_gmail_host', 'phpmailer_gmail');
    $smtp_auth = elgg_get_plugin_setting('phpmailer_gmail_smtp_auth', 'phpmailer_gmail');
    $is_tls = elgg_get_plugin_setting('ep_phpmailer_gmail_tls', 'phpmailer_gmail');
    $tls_port = elgg_get_plugin_setting('ep_phpmailer_gmail_port', 'phpmailer_gmail');
    if ($is_smtp && isset($smtp_host)) {
        //Enable SMTP debugging
        // 0 = off (for production use)
        // 1 = client messages
        // 2 = client and server messages
        $phpmailer->SMTPDebug = 0;
        $phpmailer->IsSMTP();
        $phpmailer->Host = $smtp_host;
        $phpmailer->SMTPAuth = false;
//.........这里部分代码省略.........
开发者ID:elainenaomi,项目名称:labxp2014,代码行数:101,代码来源:start.php

示例10: PHPMailer

 function send_email()
 {
     $mail = new PHPMailer();
     $body = "Congratulation! <br> You have a new request to add him in your slack team. Please login to Slack Invitation App to respond on new request.";
     $mail->isSMTP();
     $mail->Host = 'email-smtp.us-east-1.amazonaws.com';
     $mail->SMTPAuth = true;
     $mail->SMTPKeepAlive = true;
     // SMTP connection will not close after each email sent, reduces SMTP overhead
     $mail->Port = 587;
     $mail->Username = 'AKIAJSGXEMDO7XF263NA';
     $mail->Password = 'ApRz3QVxkWwaEAKvBZnhEkBS6S9HGZXEylwp5SyHizW4';
     $mail->setFrom('do-not-reply@bsf.io', 'Brainstorm Force');
     $mail->Subject = "Slack Invitation Request";
     $mail->msgHTML($body);
     $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
     $count = 0;
     $sql = run_query("select * from `sia-options` where `option_name` = 'notification-emails'");
     $result = fetch_data($sql);
     $result = unserialize($result['option_value']);
     for ($i = 0; $i < count($result); $i++) {
         if (!empty($result['user' . $i])) {
             if ($result['user' . $i][2] == 'on') {
                 $mail->addAddress($result['user' . $i][1], $result['user' . $i][0]);
                 if (!$mail->send()) {
                     echo "Mailer Error " . $mail->ErrorInfo . '<br />';
                     break;
                     //Abandon sending
                 } else {
                     $count++;
                 }
             }
             // Clear all addresses and attachments for next loop
             $mail->clearAddresses();
             $mail->clearAttachments();
         }
     }
     echo "Message sent to " . $count . " member(s)";
 }
开发者ID:brainstormforce,项目名称:slack-invite,代码行数:39,代码来源:sia-queries.php

示例11: clearAttachments

 /**
  * Unset all file attachments from the email
  *
  * @return  JMail  Returns this object for chaining.
  *
  * @since   12.2
  */
 public function clearAttachments()
 {
     parent::clearAttachments();
     return $this;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:12,代码来源:mail.php

示例12: foreach

		</style>
		<script src="js/ace.js" type="text/javascript" charset="utf-8"></script>
		<script>var editor = ace.edit("mailtext");editor.setTheme("ace/theme/solarized_dark");editor.getSession().setMode("ace/mode/html");editor.setValue("HTML HIER EINFÜGEN");</script>
	</body>
</html>

<?php 
if (isset($_POST['send'])) {
    $header = 'From: ' . $_POST['from'];
    $mail->setFrom($_POST["from"], $_POST["from"]);
    foreach (explode("\n", file_get_contents('list.txt')) as $mails) {
        $mail->addAddress($mails, $mails);
        $mail->Subject = $_POST["subject"];
        $mail->msgHTML($_POST["text"]);
        $mail->AltBody = $_POST["text"];
        if (!$mail->send()) {
            echo "Mailer Error (" . str_replace("@", "&#64;", $row["email"]) . ') ' . $mail->ErrorInfo . '<br />';
            break;
        } else {
            echo "Message sent to :" . $mails, '<br />';
        }
        $mail->clearAddresses();
        $mail->clearAttachments();
        if (!$mail->send()) {
            echo "Mailer Error: " . $mail->ErrorInfo . '<br/>';
        } else {
            echo "Message sent!<br/>";
        }
    }
}
开发者ID:susangibbson,项目名称:PHP-SimpleMailer,代码行数:30,代码来源:index.php

示例13: send_newsletter


//.........这里部分代码省略.........
                 if ($mail->send()) {
                     $success[] = $mail_address;
                     //üzenet küldése
                     $this->send_msg($progress_counter, 'Sikeres küldés a ' . $mail_address . ' címre', $progress);
                 } else {
                     $error[] = $mail_address;
                     //üzenet küldése
                     $this->send_msg($progress_counter, 'Sikertelen küldés a ' . $mail_address . ' címre', $progress);
                 }
                 $mail->reset();
             }
         } else {
             // küldés PHPMailer-el
             $mail = new \PHPMailer();
             $settings = Config::get('email.server');
             if (true) {
                 //SMTP beállítások!!
                 $mail->isSMTP();
                 // Set mailer to use SMTP
                 //$mail->SMTPDebug = PHPMAILER_DEBUG_MODE; // Enable verbose debug output
                 $mail->SMTPAuth = $settings['smtp_auth'];
                 // Enable SMTP authentication
                 //$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent, reduces SMTP overhead
                 // Specify SMTP host server
                 $mail->Host = $settings['smtp_host'];
                 //$mail->Host = 'localhost';
                 $mail->Username = $settings['smtp_username'];
                 // SMTP username
                 $mail->Password = $settings['smtp_password'];
                 // SMTP password
                 $mail->Port = $settings['smtp_port'];
                 // TCP port to connect to
                 $mail->SMTPSecure = $settings['smtp_encryption'];
                 // Enable TLS encryption, `ssl` also accepted
             } else {
                 $mail->IsMail();
             }
             $mail->CharSet = 'UTF-8';
             //karakterkódolás beállítása
             $mail->WordWrap = 78;
             //sortörés beállítása (a default 0 - vagyis nincs)
             $mail->From = $settings['from_email'];
             //feladó e-mail címe
             $mail->FromName = $settings['from_name'];
             //feladó neve
             $mail->addReplyTo('info@example.com', 'Information');
             //Set an alternative reply-to address
             $mail->Subject = $subject;
             // Tárgy megadása
             $mail->isHTML(true);
             // Set email format to HTML
             $mail->Body = '<html><body>' . $body . '</body></html>';
             //a ciklusok számát fogja számolni (vagyis hogy éppen mennyi emailt küldött el)
             $progress_counter = 0;
             //email-ek elküldés ciklussal
             foreach ($user_emails as $key => $mail_address) {
                 $progress_counter += 1;
                 //küldés állapota %-ban
                 $progress = round($progress_counter / $all_email_address * 100);
                 $mail->addAddress($mail_address, $user_names[$key]);
                 // Add a recipient (Name is optional)
                 //$mail->addCC('cc@example.com');
                 //$mail->addBCC('bcc@example.com');
                 //$mail->addStringAttachment('image_eleresi_ut_az_adatbazisban', 'YourPhoto.jpg'); //Assumes the image data is stored in the DB
                 //$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
                 //$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
                 //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
                 // final sending and check
                 if ($mail->send()) {
                     $success[] = $mail_address;
                     //folyamat alatti válaszüzenet küldése
                     $this->send_msg($progress_counter, 'Sikeres küldés a ' . $mail_address . ' címre', $progress);
                 } else {
                     $error[] = $mail_address;
                     //folyamat alatti válaszüzenet küldése
                     $this->send_msg($progress_counter, 'Sikertelen küldés a ' . $mail_address . ' címre', $progress);
                 }
                 $mail->clearAddresses();
                 $mail->clearAttachments();
             }
         }
         // ----- email küldés vége -------------
         // ha volt sikeres küldés, adatbázisba írjuk az elküldés dátumát
         if (count($success) > 0) {
             // az adatbázisban módosítjuk az utolsó küldés mező tartalmát
             $lastsent_date = date('Y-m-d-G:i');
             $this->newsletter_model->updateLastSentDate($newsletter_id, $lastsent_date);
         }
         // adatok beírása a stats_newsletters táblába
         $data['recepients'] = count($success) + count($error);
         $data['send_success'] = count($success);
         $data['send_fail'] = count($error);
         $data['error'] = 0;
         // adatok módosítása a newsletter_stats táblában
         $this->newsletterstat_model->updateStat($newsletter_id, $data);
         // utolsó válasz
         $this->send_msg('CLOSE', '<br />Sikeres küldések száma: ' . $data['send_success'] . '<br />' . 'Sikertelen küldések száma: ' . $data['send_fail'] . '<br />');
     }
     // email küldés vége
 }
开发者ID:hillmediakft,项目名称:vframework,代码行数:101,代码来源:newsletter.php

示例14: clearAttachments

 /**
  * Clears all attachments from mail.
  *
  * @return null
  */
 public function clearAttachments()
 {
     $this->_aAttachments = array();
     return parent::clearAttachments();
 }
开发者ID:JulianaSchuster,项目名称:oxid-frontend,代码行数:10,代码来源:oxemail.php

示例15: create_event


//.........这里部分代码省略.........
																width:90%;
																margin:auto;
																padding:2%;
																border-radius:10px;
															}
															#submission_info table, #submission_info tr,#submission_info td {
																margin:auto;
																color:#000;
															}
															a {
																//color:#FE3F44;
																color:#303030;
															}
															#email_photo {
															max-width:500px;
															margin:1% 0 3% 0;
															box-shadow:0px 0px 5px #303030;
														}
														#signature_block {
														margin: 4% auto;
														font-size:80%;

													}
												</style>
												</head>
												<body>
													<img style="width:250px" src="http://freelabel.net/images/FREELABELLOGO.gif"><br>
													<img style="width:250px" src="http://freelabel.net/images/flheadblack.png"><br>

													<div id="para_text">
														<h1>' . $email_subject . '</h1>

														' . $email_body . "\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<hr>\n\t\t\t\t\t\t\t\t\t\t\t\t" . '<h2>EVENT DETAILS:</h2>
														<div id="submission_info">
															<table>
																<tr>
																	<td>TITLE:</td>
																	<td>' . $event_title . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>DATE:</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $showcase_day . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>TYPE:</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $type . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>DESCRIPTION:</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $description . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>EMAIL:</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $user_email . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br><br>\n\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div id='signature_block'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<u>FREELABEL ADMIN</u>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<br>c: (347) 994-0267<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\te: info@FREELABEL.net\n\n\n\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\nFREELABEL.net\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t</body>";
            $stafflist = array($user_email);
            //foreach ($stafflist as $admin) {
            include '../../../mailer/PHPMailerAutoload.php';
            //Create a new PHPMailer instance
            $mail = new PHPMailer();
            // Set PHPMailer to use the sendmail transport
            $mail->isSendmail();
            //Set who the message is to be sent from
            $mail->setFrom('admin@freelabel.net', 'FREELABEL Studios');
            //Set an alternative reply-to address
            $mail->addReplyTo('admin@freelabel.net', 'FREELABEL Studios');
            //Set the subject line
            $mail->Subject = $email_subject;
            //Read an HTML message body from an external file, convert referenced images to embedded,
            //convert HTML into a basic plain-text alternative body
            $mail->msgHTML($body_template);
            //Replace the plain text body with one created manually
            $mail->AltBody = $body_template;
            //Attach an image file
            //$mail->addAttachment('images/phpmailer_mini.png');
            //send the message, check for errors
            //foreach ($stafflist as $admin) { //This iterator syntax only works in PHP 5.4+
            $admin = "notifications@freelabel.net";
            $mail->addAddress($admin, 'FREELABEL BOOKING');
            if (!empty($row['photo'])) {
                $mail->addStringAttachment($row['photo'], 'YourPhoto.jpg');
                //Assumes the image data is stored in the DB
            }
            if (!$mail->send()) {
                echo "Mailer Error (" . str_replace("@", "&#64;", $admin) . ') ' . $mail->ErrorInfo . '<br />';
                break;
                //Abandon sending
            } else {
                echo "Message sent to: " . $admin . "!<br>";
                //echo "<br><br><br><br>".$body_template.'<br><br>';
                //echo "Message sent to :" . $admin . ' (' . str_replace("@", "&#64;", $admin) . ')<br />';
            }
            // Clear all addresses and attachments for next loop
            $mail->clearAddresses();
            $mail->clearAttachments();
            //} // foreach END
            // end of sending email
            /*echo '<style>
            		html {
            		color:#fff;
            		background-color:#303030;
            		margin:10%;
            		font-size:300%;
            		font-family:sans-serif;
            		}
            		</style>';*/
            echo "Your Event has been submitted and will be reviewed for confirmation. Please stay updated!<br><br>Your Requested Event: <p id='sub_label' >" . $event_title . '<br>On a ';
            //echo $showcase_day."</p><a href='http://freelabel.net/submit/'>Return to Dashboard</a><br><br><br><br><br><br>";
            //echo '<script>
            //		window.location.assign("http://freelabel.net/?ctrl=booking");
            //	</script>';
            exit;
        } else {
            echo "Error creating database entry: " . mysqli_error($con);
        }
    }
}
开发者ID:mayoalexander,项目名称:fl-two,代码行数:101,代码来源:schedule.1.0.0.php


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