• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Mail_mime类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Mail_mime类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: send

 public function send()
 {
     // going to construct a Mime email
     $mime = new Mail_mime("\n");
     if (isset($this->mTxt) && $this->mTxt) {
         $mime->setTXTBody(wordwrap($this->mText));
     }
     $mime->setHTMLBody($this->mHtml);
     /*
     $fileTypes = array(
     	'gif' => array(
     		'extension'		=> 'gif',
     		'mime'			=> 'image/gif'
     	)
     );
     
     foreach ($fileTypes as $fileType) {
     	$files = $this->getFilesArrayFromHTML($this->mHtml, '.'.$fileType['extension']);
     	$fileNameCache = array();
     	
     	foreach($files as $fileName){
     		if(!in_array($fileName, $fileNameCache)){
     			$mime->addHTMLImage($this->imageDir.$fileName, $fileType['mime'],$fileName);
     			$fileNameCache[] = $fileName;
     		}
     	}	
     
     	$fileNameCache = array();
     }
     
     $max_attachment_size = 3000000;
     $attachment_size_sum = 0;
     */
     // get the content
     $content = $mime->get(['html_charset' => self::HTML_CHARSET, 'text_charset' => self::TEXT_CHARSET, 'head_charset' => self::HEAD_CHARSET]);
     // Strip the headers of CR and LF characters
     $this->mHeaders = str_replace(["\r", "\n"], '', $this->mHeaders);
     // get the headers (must happen after get the content)
     $hdrs = $mime->headers($this->mHeaders);
     // send the email
     try {
         $this->params['sendmail_path'] = '/usr/sbin/sendmail';
         $mail = Mail::factory('sendmail', $this->params);
         if (PEAR::isError($mail)) {
             print 'Failed to initialize PEAR::Mail: ' . $mail->toString();
             $response->setFault(MPSN_FAULT_GEN_ERROR);
         } else {
             $result = $mail->send($this->mHeaders['To'], $hdrs, $content);
             if (PEAR::isError($result)) {
                 print_r($result);
                 return false;
             } else {
                 return true;
             }
         }
     } catch (Exception $e) {
         print_r($e);
         return false;
     }
 }
开发者ID:arzynik,项目名称:cana,代码行数:60,代码来源:Email.php


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


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


示例6: 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 = "[email protected]";
     }
     $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


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


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


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


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


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


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


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


示例14: rsvp_notifications

function rsvp_notifications($rsvp, $rsvp_to, $subject, $message)
{
    include 'Mail.php';
    include 'Mail/mime.php';
    $mail =& Mail::factory('mail');
    $text = $message;
    $html = "<html><body>\n" . wpautop($message) . '</body></html>';
    $crlf = "\n";
    $hdrs = array('From' => '"' . $rsvp["first"] . " " . $rsvp["last"] . '" <' . $rsvp["email"] . '>', 'Subject' => $subject);
    $mime = new Mail_mime($crlf);
    $mime->setTXTBody($text);
    $mime->setHTMLBody($html);
    //do not ever try to call these lines in reverse order
    $body = $mime->get();
    $hdrs = $mime->headers($hdrs);
    $mail->send($rsvp_to, $hdrs, $body);
    // now send confirmation
    $hdrs = array('From' => $rsvp_options["rsvp_to"], 'Subject' => "Confirming RSVP {$answer} for " . $post->post_title . " {$date}");
    $mime = new Mail_mime($crlf);
    $mime->setTXTBody($text);
    $mime->setHTMLBody($html);
    //do not ever try to call these lines in reverse order
    $body = $mime->get();
    $hdrs = $mime->headers($hdrs);
    $mail->send($rsvp["email"], $hdrs, $body);
}
开发者ID:ryan2407,项目名称:Vision,代码行数:26,代码来源:rsvpmaker-custom.php


示例15: mail_notification

/**
 * @fn		mail_notification($recipients="",$message="-unknown message-")
 * @brief	sends email to one recipient, if proper dependencies are installed
 * 
 * @param string $recipients        	
 * @param string $message        	
 * @return void number Requires:
 *         1. Pear/Main
 *         2. Net/SMTP
 */
function mail_notification($recipients = "", $message = "-unknown message-")
{
    // Recipients currently only one!(separated by , ) todo: how do we implement ability for more than one mail recipient?
    global $system_message, $enable_email_notification, $mail_host, $append_to_username, $email_reply_address, $IPP_ORGANIZATION;
    if (!$enable_email_notification) {
        return;
    }
    if (!@(include_once "Mail.php")) {
        $system_message = "Your administrator does not have the Pear Mail Class installed<BR>No email notification has been sent<BR>";
        // todo: add netSMTP to installation requirements
        return 0;
    }
    // pear mail module.
    if (!@(include_once "Mail/mime.php")) {
        $system_message = "You do not have the Pear Mail Class installed<BR>No email notification sent<BR>";
        return 0;
    }
    // mime class
    if (!@(include_once "Net/SMTP.php")) {
        $system_message = "Your administrator does not have the Net/SMTP Pear Class installed<BR>No email notification has been sent<BR>";
        return 0;
    }
    $recipients = $recipients . $append_to_username;
    // Recipients (separated by , )
    // echo "send to: " . $recipients . "<BR>"; todo: this is commented out; justify its existence or strip
    $headers["From"] = $email_reply_address;
    $headers["Subject"] = "IPP System ({$IPP_ORGANIZATION})";
    // Subject of the address
    $headers["MIME-Version"] = "1.0";
    $headers["To"] = $recipients;
    // $headers["Content-type"] = "text/html; charset=UTF-8"; todo: note charset. Determine charset and standardize; this code is out - determine why
    $mime = new Mail_mime("\r\n");
    // dangerous characters escaped
    // $mime->setTxtBody("This is an HTML message only"); todo: why is this disabled (commented)?
    // $mime->_build_params['text_encoding']='quoted_printable'; todo: why is this also disabled? justify keeping it or strip
    $mime->setHTMLBody("<html><body>{$message}</body></html>");
    $mime->setTXTBody($message);
    // $mime->addAttachment("Connection.pdf","application/pdf"); todo: note this is disabled by commenting characters. What do we need to do to make the system email a pdf?
    $body = $mime->get();
    $hdrs = $mime->headers($headers);
    $params["host"] = $mail_host;
    // SMTP server (mail.yourdomain.net)
    $params["port"] = "25";
    // Leave as is - todo: note this is default smtp mail port
    $params["auth"] = false;
    // Leave as is
    $params["username"] = "user";
    // Username of from account
    $params["password"] = "password";
    // Password of the above
    // Create the mail object using the Mail::factory method
    $mail_object =& Mail::factory("smtp", $params);
    // todo - establish an understanding of this method and compare to contemporary best practive
    $mail_object->send($recipients, $hdrs, $body);
    // Send the email using the Mail PEAR Class
    // echo "send to: $recipients,<BR>headers: $hdrs,<BR>body: $body<BR>"; todo: note this html output is disabled; there is no confirmation in this code
}
开发者ID:Byrnesz,项目名称:MyIEP,代码行数:67,代码来源:mail_functions.php


示例16: xmail

function xmail($to, $subject, $body)
{
    $message = snippet(EMAIL_SHELL, array('body' => $body));
    $hdrs = array('From' => EMAIL_FROM, 'Subject' => $subject);
    $mime = new Mail_mime(array('eol' => $crlf));
    $mime->setTXTBody(strip_tags($html));
    $mime->setHTMLBody($message);
    $body = $mime->get();
    $hdrs = $mime->headers($hdrs);
    $mail =& Mail::factory('mail');
    $mail->send($to, $hdrs, $body);
}
开发者ID:pveinberg,项目名称:code,代码行数:12,代码来源:email.php


示例17: SendEmail

 /**
  * Sends an email
  * 
  * @param array $attachment_files an array containing files to be attached with email.
  * @param string $from the sender of the email.
  * @param string $to the reciever of the email.
  * @param string $subject the subject of the email.
  * @param string $message the message of the email.			 			  			  					 
  * @throws Exception throws an exception if the file size is greater than a limit or the file extension is not valid or the uploaded file could not be copied
  * 
  * @return boolean $is_sent used to indicate if the email was sent.
  */
 public function SendEmail($attachment_files, $from, $to, $subject, $text)
 {
     try {
         /** The email text is encoded */
         $processed = htmlentities($text);
         /** If the encoded text is same as the original text then the text is considered to be plain text */
         if ($processed == $text) {
             $is_html = false;
         } else {
             $is_html = true;
         }
         /** If the attachment files were given */
         if (is_array($attachment_files)) {
             /** Mail_mine object is created */
             $message = new \Mail_mime();
             /** If the message is not html */
             if (!$is_html) {
                 $message->setTXTBody($text);
             } else {
                 $message->setHTMLBody($text);
             }
             /** Each given file is attached */
             for ($count = 0; $count < count($attachment_files); $count++) {
                 $path_of_uploaded_file = $attachment_files[$count];
                 if ($path_of_uploaded_file != "") {
                     $message->addAttachment($path_of_uploaded_file);
                 }
             }
             /** The message body is fetched */
             $body = $message->get();
             /** The extra headers */
             $extraheaders = array("From" => $from, "Subject" => $subject, "Reply-To" => $from);
             /** The email headers */
             $headers = $message->headers($extraheaders);
         } else {
             /** The message body */
             $body = $text;
             /** The message headers */
             $headers = array("From" => $from, "Subject" => $subject, "Reply-To" => $from);
         }
         /** The Mail class object is created */
         $mail = new \Mail("mail");
         /** The email is sent */
         $is_sent = $mail->send($to, $headers, $body);
         if (!$is_sent) {
             throw new \Exception("Email could not be sent. Details: " . $e->getMessage());
         } else {
             return true;
         }
     } catch (\Exception $e) {
         throw new \Exception("Email could not be sent. Details: " . $e->getMessage());
     }
 }
开发者ID:Negative-Network,项目名称:Pak-PHP,代码行数:65,代码来源:Email.php


示例18: send

 public function send()
 {
     include 'Mail.php';
     include 'Mail/mime.php';
     $mime = new Mail_mime();
     $mime->setTXTBody($this->text_body);
     $mime->setHTMLBody($this->html_body);
     $body = $mime->get();
     $headers = $mime->headers($this->headers);
     $mail_object =& Mail::factory('mail');
     $mail_object->send($this->headers['To'], $headers, $body);
 }
开发者ID:TheOddLinguist,项目名称:toolbox,代码行数:12,代码来源:class.mailer.php


示例19: sendEmailViaAmazon

 public function sendEmailViaAmazon($title, $body, $args)
 {
     $mail_mime = new Mail_mime();
     $mail_mime->setHTMLBody($body);
     $body = $mail_mime->get();
     $headers = $mail_mime->txtHeaders(array('From' => 'Comnovo Web Service<' . SERVICE_EMAIL . '>', 'Reply-To' => SERVICE_EMAIL, 'Subject' => "{$title}"));
     $message = $headers . "\r\n" . $body;
     $sendResult = $this->emailConnetHandler->send_raw_email(array('Data' => base64_encode($message)), array('Destinations' => $args['user_email']));
     if ($sendResult->isOK()) {
         print "Mail sent; message id is " . (string) $sendResult->body->SendRawEmailResult->MessageId . "\n";
     } else {
         print "Mail not sent; error is " . (string) $sendResult->body->Error->Message . "\n";
     }
 }
开发者ID:Rming,项目名称:novophp,代码行数:14,代码来源:ResetPasswordEmail_Job.php


示例20: sendMail

    function sendMail($to, $subject, $mailText, $from = "", $type = "", $prozess = 1)
    {
        Logger::getInstance()->Log($to, LOG_ABLAUF);

        $message = new Mail_mime("\n");
        // watt isn dat hier für ne funktion? die macht mit sicherheit alles, aber keinen html-Body
        $message->setHTMLBody($mailText);
        if ($this->attachement != null)
        {
            foreach ($this->attachement AS $attachment)
                $messageatt = $message->addAttachment($attachment);
            //Logger::getInstance()->Log($messageatt,LOG_ABLAUF);
            $this->attachement = null;
        }

        if (empty($from))
            $header['From'] = $this->from;
        else
            $header['From'] = $from;
        $header['Subject'] = $subject;
        $header['To'] = $to;
        $header['Date'] = date("D, d M Y H:i:s O");
        $header['Message-ID'] = '<' . time() . '.' . $prozess . '@' . $this->host . '>';


        $messBody = $message->get(array("text_encoding" => "quoted-printable"));
        if ($type == 'html')
            $messBody = '<html><body>' . $messBody . '</body></html>';

        $header2 = $message->headers($header);

        $error_obj = self::$mailer->send($to, $header2, $messBody);


        if (is_object($error_obj))
        {
            //Logger::getInstance()->Log($message, LOG_ABLAUF);
            $errorString = ob_get_contents();
            file_put_contents(PATH . 'mail.error.log', $errorString);
            return false;
        }
        else
        {


            //z('email was send successfully!');
            return true;
        }
    }
开发者ID:hlag,项目名称:svs,代码行数:49,代码来源:Mailer.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Mail_mimeDecode类代码示例发布时间:2022-05-23
下一篇:
PHP Mail_RFC822类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap