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


PHP Mail_mime::headers方法代码示例

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


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

示例1: emailNotification

/**
 * emailNotification()
 * creates an email message with the pdf and sends it
 * 
 * @param		string			pdf binary/string stream
 * @param		array			customer information array
 * @param		array			smtp server information
 * @param		string			from email address of the sender identity
 */
function emailNotification($pdfDocument, $customerInfo, $smtpInfo, $from)
{
    global $base;
    if (empty($customerInfo['business_email'])) {
        return;
    }
    $headers = array("From" => $from, "Subject" => "User Invoice Notification", "Reply-To" => $from);
    $mime = new Mail_mime();
    $mime->setTXTBody("Notification letter of service");
    $mime->addAttachment($pdfDocument, "application/pdf", "invoice.pdf", false, 'base64');
    $body = $mime->get();
    $headers = $mime->headers($headers);
    $mail =& Mail::factory("smtp", $smtpInfo);
    $mail->send($customerInfo['business_email'], $headers, $body);
}
开发者ID:fevenor,项目名称:Dockerfile,代码行数:24,代码来源:processNotificationUserDetailsInvoice.php

示例2: send_email

 private function send_email($to, $subject, $body, $attachments)
 {
     require_once 'Mail.php';
     require_once 'Mail/mime.php';
     require_once 'Mail/mail.php';
     $headers = array('From' => _EMAIL_ADDRESS, 'To' => $to, 'Subject' => $subject);
     // attachment
     $crlf = "\n";
     $mime = new Mail_mime($crlf);
     $mime->setHTMLBody($body);
     //$mime->addAttachment($attachment, 'text/plain');
     if (is_array($attachments)) {
         foreach ($attachments as $attachment) {
             $mime->addAttachment($attachment, 'text/plain');
         }
     }
     $body = $mime->get();
     $headers = $mime->headers($headers);
     $smtp = Mail::factory('smtp', array('host' => _EMAIL_SERVER, 'auth' => true, 'username' => _EMAIL_USER, 'password' => _EMAIL_PASSWORD));
     $mail = $smtp->send($to, $headers, $body);
     if (PEAR::isError($mail)) {
         echo "<p>" . $mail->getMessage() . "</p>";
     } else {
         echo "<p>Message successfully sent!</p>";
     }
 }
开发者ID:CommLegal,项目名称:claimPortal,代码行数:26,代码来源:email_class.php

示例3: sendEmail

 function sendEmail()
 {
     foreach ($this->to as $to) {
         $headers = array('From' => SMTP_FROM_NAME . "<" . SMTP_FROM . ">", 'To' => $to, 'Subject' => $this->subject);
         $mime = new Mail_mime($this->NEW_LINE);
         if ($this->body == null) {
             if ($this->compiledTXT != null && strlen($this->compiledTXT) > 0) {
                 $mime->setTXTBody($this->compiledTXT);
             }
             if ($this->compiledHTML != null && strlen($this->compiledHTML) > 0) {
                 $mime->setHTMLBody($this->compiledHTML);
             }
         } else {
             $mime->setTXTBody($this->body);
         }
         foreach ($this->cc as $email) {
             $mime->addCc($email);
         }
         foreach ($this->bcc as $email) {
             $mime->addBcc($email);
         }
         if (is_array($this->files) && count($this->files) > 0) {
             foreach ($this->files as $file) {
                 $mime->addAttachment($file["path"], $file["content-type"]);
             }
         }
         $body = $mime->get();
         $headers = $mime->headers($headers);
         $string = "";
         foreach ($headers as $key => $value) {
             $string .= "{$key}: {$value}\r\n";
         }
         $smtpOptions = array('host' => SMTP_HOST, 'port' => SMTP_PORT);
         if (defined("SMTP_USER_NAME") && defined("SMTP_PASSWORD")) {
             $smtpOptions['auth'] = true;
             $smtpOptions['username'] = SMTP_USER_NAME;
             $smtpOptions['password'] = SMTP_PASSWORD;
         }
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         $smtp = Mail::factory('smtp', $smtpOptions);
         $success = $smtp->send($to, $headers, $body);
         if ($success !== true) {
             throw new PEARErrorException($success);
         }
     }
 }
开发者ID:hikirsch,项目名称:obj_tmpl_mailer,代码行数:46,代码来源:TemplateEmail.php

示例4: eMail

 function eMail($row, $user = '')
 {
     $lastRun = $this->getLastReportRun($row['subscription_name']);
     $html = $lastRun['report_html'];
     if ($html == '' || $html == 'NULL') {
         return FALSE;
     }
     // Remove google chart data
     $css = file_get_contents('/var/www/html/css/mail.css');
     $message = "<html>\n<head>\n<style>\n{$css}\n</style>\n</head>\n";
     $html = str_replace("<td class='chart'>", "<td>", $html);
     $sp1 = strpos($html, "<body>");
     $sp2 = strpos($html, "<form");
     $sp3 = strpos($html, "</form>");
     $message .= substr($html, $sp1, $sp2 - $sp1);
     $message .= "<p><a href='https://analytics.atari.com/report_log.php?_report=" . $row['subscription_name'] . "&_cache=" . $lastRun['report_startts'] . "'>View This In A Browser</a></p>";
     $message .= substr($html, $sp3 + strlen('</form>'));
     // Now Email the results
     $crlf = "\n";
     $hdrs = array('Subject' => "Atari Analytics: Report: " . $row['subscription_title'] . ". Run completed successfully at " . $lastRun['report_endts'] . ".");
     $mime = new Mail_mime(array('eol' => $crlf));
     $mime->setHTMLBody($message);
     $mime->addAttachment("/tmp/" . $lastRun['report_csv'], 'text/plain');
     $body = $mime->get();
     $hdrs = $mime->headers($hdrs);
     $mail =& Mail::factory('mail');
     if ($user == '') {
         $mail->send($row['subscription_list'], $hdrs, $body);
     } else {
         $mail->send($user, $hdrs, $body);
     }
     return TRUE;
 }
开发者ID:rjevansatari,项目名称:Analytics,代码行数:33,代码来源:Email_Class.php

示例5: sendMail

function sendMail($absender_email, $absender_name, $Empfaenger, $Betreff, $content, $attachments)
{
    global $config;
    $crlf = "\n";
    $from = "{$absender_name} <{$absender_email}>";
    $headers = array('From' => $from, 'To' => $Empfaenger, 'Subject' => $Betreff);
    $mime = new Mail_mime(array('eol' => $crlf));
    $mime->setTXTBody($content);
    if (isset($attachments)) {
        foreach ($attachments as $attachment) {
            if (isset($attachment["filename"]) && $attachment["filename"] != "" && isset($attachment["mailname"]) && $attachment["mailname"] != "") {
                $mime->addAttachment($attachment["filename"], 'application/octet-stream', $attachment["mailname"], true, 'base64');
            }
        }
    }
    $body = $mime->get(array('html_charset' => 'utf-8', 'text_charset' => 'utf-8', 'eol' => $crlf));
    $hdrs = $mime->headers($headers);
    $smtp = Mail::factory('smtp', array('host' => $config['smtphost'], 'auth' => true, 'username' => $config['smtpusername'], 'password' => $config['smtppassword']));
    $mail = $smtp->send($Empfaenger, $hdrs, $body);
    /*
    if (PEAR::isError($mail)) {
    echo("<p>" . $mail->getMessage() . "</p>");
    } else {
    echo("<p>Message successfully sent!</p>");
    }
    */
    //	mail($Empfaenger, $Betreff, $text, $Header) or die('Die Email
    //	konnte nicht versendet werden');
}
开发者ID:nkaligin,项目名称:oobd,代码行数:29,代码来源:mail.php

示例6: sendAccessibleCaptchaEmail

/**
* Send a CAPTCHA verification email to the supplied address
*
* @param string	$to_email_address	The destination email address
* @param string	$key				The shared CAPTCHA verification key (in the email and the user's session)
*
* @access public
* @return void
*/
function sendAccessibleCaptchaEmail($to_email_address, $key)
{
    require_once 'Mail.php';
    require_once 'Mail/mime.php';
    // Strip spaces from around the "To" address in case these are present
    $to_email_address = trim($to_email_address);
    // Provide the name of the system as supplied in the main.inc configuration for use in the email (if it is set)
    $from_address = '"Accessible CAPTCHA Form"';
    if (SQ_CONF_SYSTEM_NAME != '') {
        $from_system_name = 'from the ' . SQ_CONF_SYSTEM_NAME . ' website ';
        $from_address = SQ_CONF_SYSTEM_NAME;
    }
    // Quote the System Name as it could contain apos'rophes
    $from_address = '"' . $from_address . '"';
    $current_url = current_url();
    $body = 'This email has been generated ' . $from_system_name . "as part of a form submission which includes an Accessible CAPTCHA field.\n\n" . "Please visit the following page to validate your submission before submitting the form\n\n" . $current_url . '?key=' . $key;
    $mime = new Mail_mime("\n");
    $mime->setTXTBody($body);
    $from_address .= ' <' . SQ_CONF_DEFAULT_EMAIL . '>';
    $headers = array('From' => $from_address, 'Subject' => 'Accessible CAPTCHA Form Verification');
    $param = array('head_charset' => SQ_CONF_DEFAULT_CHARACTER_SET, 'text_charset' => SQ_CONF_DEFAULT_CHARACTER_SET, 'html_charset' => SQ_CONF_DEFAULT_CHARACTER_SET);
    $body = @$mime->get($param);
    $headers = @$mime->headers($headers);
    $mail =& Mail::factory('mail');
    $status = @$mail->send($to_email_address, $headers, $body);
}
开发者ID:joshgillies,项目名称:mysource-matrix,代码行数:35,代码来源:accessible_captcha.php

示例7: send

 public function send($to, $subject, $message, $html = 0, $from = '')
 {
     $headers["From"] = $from == '' ? $this->from : $from;
     $headers["To"] = $to;
     $headers["Subject"] = $subject;
     $headers["Content-Type"] = 'text/html; charset=UTF-8';
     $headers["Content-Transfer-Encoding"] = "8bit";
     $mime = new Mail_mime();
     if ($html == 0) {
         $mime->setTXTBody($message);
     } else {
         $mime->setHTMLBody($message);
     }
     $mimeparams['text_encoding'] = "8bit";
     $mimeparams['text_charset'] = "UTF-8";
     $mimeparams['html_charset'] = "UTF-8";
     $mimeparams['head_charset'] = "UTF-8";
     $body = $mime->get($mimeparams);
     $headers = $mime->headers($headers);
     // SMTP server name, port, user/passwd
     $smtpinfo["host"] = $this->host;
     $smtpinfo["port"] = $this->port;
     $smtpinfo["auth"] = $this->auth;
     $smtpinfo["username"] = $this->username;
     $smtpinfo["password"] = $this->password;
     $smtpinfo["debug"] = false;
     $to = array($to);
     // Create the mail object using the Mail::factory method
     $mail =& Mail::factory("smtp", $smtpinfo);
     @$mail->send($to, $headers, $body);
 }
开发者ID:nmadipati,项目名称:si-ksc,代码行数:31,代码来源:email.php

示例8: MailMime

 /**
  * Send an mime mail
  * possibly only text or text + html.
  *
  * @param string or array  $recipients
  * @param string $text
  * @param string $html
  * @param array $hdrs
  */
 static public function MailMime($recipients, $text=false, $html=false, $hdrs)
 {
     include_once 'Mail.php';
     include_once 'Mail/mime.php';
 
     $crlf = "\n";
 
     $mime = new Mail_mime($crlf);
     
     if (strlen($text)) {
         $mime->setTXTBody($text);
     }
     
     if (strlen($html)) {
         $mime->setHTMLBody($html);
     }
     
     $body = $mime->get(array('head_charset' => 'UTF-8', 'text_charset' => 'UTF-8', 'html_charset' => 'UTF-8'));
     $hdrs = $mime->headers($hdrs);
     
     $mail = Mail::factory('mail');
     
     if (is_array($recipients)) {
         foreach ($recipients as $recipient) {
             $mail->send($recipient, $hdrs, $body);
         }
     } else {
         $mail->send($recipients, $hdrs, $body);   
     }
 }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:39,代码来源:CampMail.php

示例9: set_mime_body

 public function set_mime_body($text_body, $html_body, $attachments, $embeds)
 {
     if (!class_exists('Mail_mime')) {
         @(include_once 'Mail/mime.php');
     }
     if (!class_exists('Mail_mime')) {
         debug_add('Mail_mime does not exist, setting text body and aborting', MIDCOM_LOG_WARN);
         $this->_body = $text_body;
         return false;
     }
     $this->__mime = new Mail_mime("\n");
     $this->__mime->_build_params['html_charset'] = strtoupper($this->_encoding);
     $this->__mime->_build_params['text_charset'] = strtoupper($this->_encoding);
     $this->__mime->_build_params['head_charset'] = strtoupper($this->_encoding);
     $this->__mime->_build_params['text_encoding'] = '8bit';
     reset($this->__mime);
     if (strlen($html_body) > 0) {
         $this->__mime->setHTMLBody($html_body);
     }
     if (strlen($text_body) > 0) {
         $this->__mime->setTxtBody($text_body);
     }
     if (!empty($attachments)) {
         $this->_process_attachments($attachments, 'addAttachment');
     }
     if (!empty($embeds)) {
         $this->_process_attachments($embeds, 'addHTMLImage');
     }
     $this->_body = $this->__mime->get();
     $this->_headers = $this->__mime->headers($this->_headers);
     // some MTAs manage to mangle multiline headers (RFC "folded"),
     // here we make sure at least the content type is in single line
     $this->_headers['Content-Type'] = preg_replace('/\\s+/', ' ', $this->_headers['Content-Type']);
 }
开发者ID:nemein,项目名称:openpsa,代码行数:34,代码来源:message.php

示例10: send_mail

function send_mail($mail_sender, $name_sender, $mail_receiver, $subject, $message_txt, $message_html = '')
{
    require_once 'tools/contact/libs/Mail.php';
    require_once 'tools/contact/libs/Mail/mime.php';
    $headers['From'] = $mail_sender;
    $headers['To'] = $mail_sender;
    $headers['Subject'] = $subject;
    $headers["Return-path"] = $mail_sender;
    if ($message_html == '') {
        $message_html == $message_txt;
    }
    $mime = new Mail_mime("\n");
    $mimeparams = array();
    $mimeparams['text_encoding'] = "7bit";
    $mimeparams['text_charset'] = "UTF-8";
    $mimeparams['html_charset'] = "UTF-8";
    $mimeparams['head_charset'] = "UTF-8";
    $mime->setTXTBody($message_txt);
    $mime->setHTMLBody($message_html);
    $message = $mime->get($mimeparams);
    $headers = $mime->headers($headers);
    // Creer un objet mail en utilisant la methode Mail::factory.
    $object_mail =& Mail::factory(CONTACT_MAIL_FACTORY);
    return $object_mail->send($mail_receiver, $headers, $message);
}
开发者ID:YesWiki,项目名称:yeswiki-sandstorm,代码行数:25,代码来源:contact.functions.php

示例11: send

 public function send()
 {
     extract($_POST);
     $crlf = "\n";
     $mime = new Mail_mime($crlf);
     $mime->setTXTBody(strip_tags($body));
     //    $mime->setHTMLBody($body);
     $mimebody = $mime->get();
     $useremail = $this->server->user['email'];
     if ($useremail == null) {
         $useremail = "noreply@moma.org";
     }
     $to = $email_addresses;
     $headers = array('From' => $useremail, 'Subject' => $subject);
     if ($email_addresses != '') {
         $headers['To'] = $email_addresses;
     }
     if ($toself == 1) {
         $headers['Cc'] = $useremail;
         if ($to != '') {
             $to .= ', ';
         }
         $to .= $useremail;
     }
     $headers = $mime->headers($headers);
     $smtp = Mail::factory('smtp', array('host' => 'owa.moma.org'));
     $mail = $smtp->send($to, $headers, $mimebody);
     if (PEAR::isError($mail)) {
         throw new Error('Error sending e-mail: ' . $mail->getMessage());
     } else {
         return new Response('ok');
     }
 }
开发者ID:kenyattaclark,项目名称:shiftspace,代码行数:33,代码来源:email.php

示例12: main

 public function main()
 {
     if (empty($this->from)) {
         throw new BuildException('Missing "from" attribute');
     }
     $this->log('Sending mail to ' . $this->tolist);
     if (!empty($this->filesets)) {
         @(require_once 'Mail.php');
         @(require_once 'Mail/mime.php');
         if (!class_exists('Mail_mime')) {
             throw new BuildException('Need the PEAR Mail_mime package to send attachments');
         }
         $mime = new Mail_mime(array('text_charset' => 'UTF-8'));
         $hdrs = array('From' => $this->from, 'Subject' => $this->subject);
         $mime->setTXTBody($this->msg);
         foreach ($this->filesets as $fs) {
             $ds = $fs->getDirectoryScanner($this->project);
             $fromDir = $fs->getDir($this->project);
             $srcFiles = $ds->getIncludedFiles();
             foreach ($srcFiles as $file) {
                 $mime->addAttachment($fromDir . DIRECTORY_SEPARATOR . $file, 'application/octet-stream');
             }
         }
         $body = $mime->get();
         $hdrs = $mime->headers($hdrs);
         $mail = Mail::factory('mail');
         $mail->send($this->tolist, $hdrs, $body);
     } else {
         mail($this->tolist, $this->subject, $this->msg, "From: {$this->from}\n");
     }
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:31,代码来源:MailTask.php

示例13: sendMail

 /**
  * 
  * @param array $data
  * 				$data['from']
  * 				$data['to']
  * 				$data['subject']
  * 				$data['body']
  * 
  */
 public function sendMail($data)
 {
     $from = $data['from'];
     //"<from.gmail.com>";
     $to = $data['to'];
     //"<to.yahoo.com>";
     $subject = $data['subject'];
     //"Hi!";
     $body = $data['body'];
     //"Hi,\n\nHow are you?";
     $headers = array('From' => $from, 'To' => $to, 'Subject' => $subject);
     $message = new Mail_mime();
     $message->setTXTBody($body);
     // 		$message->setHTMLBody($messageHTML);
     $mimeparams = array();
     $mimeparams['text_encoding'] = "7bit";
     $mimeparams['text_charset'] = "UTF-8";
     $mimeparams['html_charset'] = "UTF-8";
     $mimeparams['head_charset'] = "UTF-8";
     $body = $message->get($mimeparams);
     $headers = $message->headers($headers);
     $smtp = Mail::factory('smtp', array('host' => $this->host, 'port' => $this->port, 'auth' => true, 'username' => $this->username, 'password' => $this->password));
     $mail = $smtp->send($to, $headers, $body);
     if (PEAR::isError($mail)) {
         error_log($mail->getMessage());
     }
 }
开发者ID:Shulyakovskiy,项目名称:dvijok,代码行数:36,代码来源:dvmail.php

示例14: pearMail

function pearMail($to, $subject, $html, $text, $headers = false)
{
    $headers = $headers ? $headers : array('From' => EMAIL, 'Subject' => $subject);
    $html = '<html>
    <head>
    <style type="text/css">
      body{font-family: Arial, sans-serif;}
      a{color: #0088cc}
      a:hover {color: #005580;text-decoration: none;}
    </style>
    </head>
      <body>' . $html . '</body>
    </html>';
    $html = $html;
    $text = utf8_decode($text);
    // We never want mails to send out from local machines. It's all too easy
    // to accidentally send out a test mail to a client or their clients.
    if (LOCAL) {
        die($html);
    } else {
        $mime = new Mail_mime();
        $mime->setTXTBody($text);
        // Add standard CSS or other mail headers to this string, and all mails will
        // be styled uniformly.
        $mime->setHTMLBody($html);
        $body = $mime->get();
        $hdrs = $mime->headers($headers);
        $mail =& Mail::factory('mail');
        $mail->send($to, $hdrs, $body);
    }
}
开发者ID:OpenStreetsCapeTown,项目名称:backoffice,代码行数:31,代码来源:functions.mail.php

示例15: send

 protected function send($alternateRecipient = null)
 {
     $mime = new Mail_mime(array("head_charset" => "utf-8", "text_charset" => "utf-8", "html_charset" => "utf-8", 'eol' => "\n"));
     $mime->setTXTBody($this->txtBody);
     if ($this->htmlBody !== null) {
         $mime->setHTMLBody($this->htmlBody);
     }
     if (!empty($this->attachments)) {
         foreach ($this->attachments as $attachment) {
             $mime->addAttachment($attachment->File(), $attachment->Type());
         }
     }
     $this->headers['To'] = $this->receipients;
     $this->headers['Sender'] = $this->headers['From'];
     $empfaenger = $this->receipients;
     if ($this->bcc !== null) {
         $this->receipients .= ($this->receipients > '' ? ',' : '') . $this->bcc;
     }
     //do not ever try to call these lines in reverse order
     $body = $mime->get();
     $headers = $mime->headers($this->headers, true);
     if ($this->receipients > '') {
         if (!$GLOBALS['Settings']['OnServer']) {
             $this->receipients = 'christian@smoice.com';
         } elseif ($alternateRecipient) {
             $this->receipients = $alternateRecipient;
         }
         $mail_queue = new Mail_Queue($GLOBALS['Settings']['MailQueue']['db_options'], $GLOBALS['Settings']['MailQueue']['mail_options']);
         $mail_queue->put($this->headers['From'], $this->receipients, $headers, $body, $this->delay);
     }
     return true;
 }
开发者ID:OdysseyDE,项目名称:omer_team_registration,代码行数:32,代码来源:Base.php


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