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


PHP PHPMailer::AddStringAttachment方法代码示例

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


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

示例1:

 /**
  * Simple plain string attachment test.
  */
 function test_Plain_StringAttachment()
 {
     $this->Mail->Body = "Here is the text body";
     $this->Mail->Subject .= ": Plain + StringAttachment";
     $sAttachment = "These characters are the content of the " . "string attachment.\nThis might be taken from a " . "database or some other such thing. ";
     $this->Mail->AddStringAttachment($sAttachment, "string_attach.txt");
     $this->BuildBody();
     $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo);
 }
开发者ID:NurulRizal,项目名称:BB,代码行数:12,代码来源:phpmailerTest.php

示例2: send

 function send()
 {
     $conf = $this->smtp;
     $mail = new PHPMailer();
     $mail->IsSMTP(false);
     //$mail->Host       = $conf['host'];
     //$mail->SMTPAuth   = true;
     $mail->IsHTML(true);
     //$mail->SMTPDebug  = 2;
     //$mail->Port       = $conf['port'];
     //$mail->Username   = $conf['user'];
     //$mail->Password   = $conf['pass'];
     //$mail->SMTPSecure = 'tls';
     $mail->setFrom($this->from, 'Onboarding Mail');
     $mail->addReplyTo($this->from, 'Onboarding Mail');
     $mail->addAddress($this->to);
     foreach ($this->attachment as $k => $att) {
         $num = $k + 1;
         $fname = "Events{$num}_" . date('h:i:s') . ".ics";
         $mail->AddStringAttachment($att, $fname, 'base64', 'text/ics');
     }
     $mail->Subject = $this->subject;
     $mail->Body = $this->bodyText;
     if (!$mail->send()) {
         echo '<pre>';
         echo 'Message could not be sent.<br>';
         echo 'Mailer Error: ' . $mail->ErrorInfo;
         exit;
     }
 }
开发者ID:IngenuityDesign,项目名称:ics-generator,代码行数:30,代码来源:emailHelper.php

示例3: array

 function wpsight_mail_send_email($data = array(), $opts = array())
 {
     if (!class_exists('PHPMailer')) {
         require ABSPATH . '/wp-includes/class-phpmailer.php';
     }
     $mail = new PHPMailer();
     $mail->CharSet = 'UTF-8';
     foreach ($data['recipients'] as $addr) {
         if (is_array($addr)) {
             $mail->AddAddress($addr[0], $addr[1]);
         } else {
             $mail->AddAddress($addr);
         }
     }
     $mail->Subject = isset($data['subject']) ? $data['subject'] : null;
     if (is_array($data['body']) && isset($data['body']['html'])) {
         $mail->isHTML(true);
         $mail->Body = $data['body']['html'];
         $mail->AltBody = isset($data['body']['text']) ? $data['body']['text'] : null;
     }
     $mail->From = $data['sender_email'];
     $mail->FromName = $data['sender_name'];
     if (isset($data['reply_to'])) {
         foreach ((array) $data['reply_to'] as $addr) {
             if (is_array($addr)) {
                 $mail->AddReplyTo($addr[0], $addr[1]);
             } else {
                 $mail->AddReplyTo($addr);
             }
         }
     }
     if (isset($data['attachments']) && is_array($data['attachments'])) {
         foreach ($data['attachments'] as $attachment) {
             $encoding = isset($attachment['encoding']) ? $attachment['encoding'] : 'base64';
             $type = isset($attachment['type']) ? $attachment['type'] : 'application/octet-stream';
             $mail->AddStringAttachment($attachment['data'], $attachment['filename'], $encoding, $type);
         }
     }
     if (isset($opts['transport']) && $opts['transport'] == 'smtp') {
         $mail->isSMTP();
         $mail->Host = $opts['smtp_host'];
         $mail->Port = isset($opts['smtp_port']) ? (int) $opts['smtp_port'] : 25;
         if (!empty($opts['smtp_user'])) {
             $mail->Username = $opts['smtp_user'];
             $mail->Password = $opts['smtp_pass'];
         }
         if (!empty($opts['smtp_sec'])) {
             $mail->SMTPSecure = $opts['smtp_sec'];
         }
     }
     do_action('wpsight_mail_pre_send', $mail, $data, $opts);
     return $mail->send() ? true : $mail->ErrorInfo;
 }
开发者ID:phucanh92,项目名称:vietlong,代码行数:53,代码来源:mail.php

示例4: sendProof

 /**
  * sendProof - email out with an attachment the proof data
  */
 function sendProof($attachment, $reviewName, $proofFile)
 {
     // TO:
     // Reviewer Test
     // Reviewer
     //$reviewerAddr = 'david.heskett@mobot.org';
     //$reviewerName = 'David Heskett';
     $reviewerAddr = 'trish.rose-sandler@mobot.org';
     $reviewerName = 'Trish Rose-Sandler';
     // FROM:
     // Automated Proof
     $fromAutoName = 'Automated Proof';
     $fromAutoAddr = 'feedback@citebank.org';
     // FILE NAME
     $filename = 'Proof-' . date('Y-m-d-H-i') . '.csv';
     // attachment filename
     // SUBJECT:
     $subject = 'Data import PROOF to review for: ' . $reviewName;
     // ATTACHMENT FILE DATA:
     //  $attachment that is provided
     // DO EET!
     $mail = new PHPMailer(true);
     //defaults to using php "mail()"; the true param means it will throw exceptions on errors, which we need to catch
     try {
         // REPLY TO:
         $mail->AddReplyTo($fromAutoAddr, $fromAutoName);
         // TO:
         $mail->AddAddress($reviewerAddr, $reviewerName);
         // FROM:
         $mail->SetFrom($fromAutoAddr, $fromAutoName);
         // SUBJECT:
         $mail->Subject = $subject;
         $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
         // optional - MsgHTML will create an alternate automatically
         $linkToProofFile = str_replace('/var/www', 'http:/', $proofFile);
         // MESSAGE:
         $msg = 'Here is a <strong>Proof</strong> of <strong>' . $reviewName . '</strong>.  <br>See : ' . $linkToProofFile . ' <br><a href="' . $linkToProofFile . '">Proof File Link</a>';
         $mail->MsgHTML($msg);
         // ATTACHMENT:
         $encoding = '8bit';
         $type = 'application/excel';
         $mail->AddStringAttachment($attachment, $filename, $encoding, $type);
         // attachment (generated on the fly, not a disk file)
         // SEND IT
         $mail->Send();
         //echo "Message Sent OK</p>\n";
         $this->proofMailed = true;
     } catch (phpmailerException $e) {
         $this->error = $e->errorMessage();
         //Pretty error messages from PHPMailer
     } catch (Exception $e) {
         $this->error = $e->getMessage();
         //Boring error messages from anything else!
     }
 }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:58,代码来源:SendProof.php

示例5: Send

 public function Send(IEmailMessage $emailMessage)
 {
     $this->phpMailer->ClearAllRecipients();
     $this->phpMailer->ClearReplyTos();
     $this->phpMailer->CharSet = $emailMessage->Charset();
     $this->phpMailer->Subject = $emailMessage->Subject();
     $this->phpMailer->Body = $emailMessage->Body();
     $from = $emailMessage->From();
     $defaultFrom = Configuration::Instance()->GetSectionKey(ConfigSection::EMAIL, ConfigKeys::DEFAULT_FROM_ADDRESS);
     $defaultName = Configuration::Instance()->GetSectionKey(ConfigSection::EMAIL, ConfigKeys::DEFAULT_FROM_NAME);
     $address = empty($defaultFrom) ? $from->Address() : $defaultFrom;
     $name = empty($defaultName) ? $from->Name() : $defaultName;
     $this->phpMailer->SetFrom($address, $name);
     $replyTo = $emailMessage->ReplyTo();
     $this->phpMailer->AddReplyTo($replyTo->Address(), $replyTo->Name());
     $to = $this->ensureArray($emailMessage->To());
     $toAddresses = new StringBuilder();
     foreach ($to as $address) {
         $toAddresses->Append($address->Address());
         $this->phpMailer->AddAddress($address->Address(), $address->Name());
     }
     $cc = $this->ensureArray($emailMessage->CC());
     foreach ($cc as $address) {
         $this->phpMailer->AddCC($address->Address(), $address->Name());
     }
     $bcc = $this->ensureArray($emailMessage->BCC());
     foreach ($bcc as $address) {
         $this->phpMailer->AddBCC($address->Address(), $address->Name());
     }
     if ($emailMessage->HasStringAttachment()) {
         Log::Debug('Adding email attachment %s', $emailMessage->AttachmentFileName());
         $this->phpMailer->AddStringAttachment($emailMessage->AttachmentContents(), $emailMessage->AttachmentFileName());
     }
     Log::Debug('Sending %s email to: %s from: %s', get_class($emailMessage), $toAddresses->ToString(), $from->Address());
     $success = false;
     try {
         $success = $this->phpMailer->Send();
     } catch (Exception $ex) {
         Log::Error('Failed sending email. Exception: %s', $ex);
     }
     Log::Debug('Email send success: %d. %s', $success, $this->phpMailer->ErrorInfo);
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:42,代码来源:EmailService.php

示例6: emailAgreement

 private function emailAgreement($mem, $pdf)
 {
     $primary = \COREPOS\Fannie\API\Member\MemberREST::getPrimary($mem);
     if (filter_var($primary[0]['email'], FILTER_VALIDATE_EMAIL)) {
         $mail = new PHPMailer();
         $mail->From = 'info@wholefoods.coop';
         $mail->FromName = 'Whole Foods Co-op';
         $mail->AddAddress($primary[0]['email']);
         $mail->Subject = 'Subscription Agreement';
         $mail->Body = 'A copy of your subscription agreement is attached.';
         $mail->AddStringAttachment($pdf, 'wfc.pdf', 'base64', 'application/pdf');
         $mail->Send();
     }
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:14,代码来源:PISignaturePage.php

示例7: send

 public function send()
 {
     // Create a PHP Mailer object and set it up
     $mailer = new \PHPMailer(true);
     $mailer->IsMail();
     // Set the emails subject
     $mailer->Subject = $this->subject;
     // Set the from address
     if (!empty($this->from)) {
         $mailer->SetFrom($this->from['email'], $this->from['name'], true);
     }
     // Set the to address
     foreach ($this->to as $to) {
         $mailer->AddAddress($to['email'], $to['name']);
     }
     // cc
     foreach ($this->cc as $cc) {
         $mailer->AddCC($cc['email'], $cc['name']);
     }
     // bcc
     foreach ($this->bcc as $bcc) {
         $mailer->AddBCC($bcc['email'], $bcc['name']);
     }
     // If we have an HTML body, set that on the message
     // and mark it as an HTML email
     if (!empty($this->htmlBody)) {
         $mailer->Body = $this->htmlBody;
         $mailer->AltBody = $this->textBody;
         $mailer->IsHTML();
     } else {
         $mailer->Body = $this->textBody;
     }
     // Attachments
     foreach ($this->attachments as $attachment) {
         $mailer->AddStringAttachment($attachment['content'], $attachment['filename'], 'base64', $attachment['mime']);
     }
     // Finally, try and send teh message
     return $mailer->Send();
 }
开发者ID:rikh42,项目名称:band-phpmailer,代码行数:39,代码来源:PHPMailerEmail.php

示例8: exitcron

function exitcron()
{
    global $log;
    global $config;
    if ($config['sendnotification'] && filter_var($config['adminemail'], FILTER_VALIDATE_EMAIL)) {
        require $config['path'] . '/libs/phpmailer/PHPMailerAutoload.php';
        $mail = new PHPMailer();
        if ($config['smtp']) {
            $mail->isSMTP();
            $mail->Host = $config['smtpserver'];
            $mail->SMTPAuth = true;
            $mail->Username = $config['smtpusername'];
            $mail->Password = $config['smtppassword'];
            $mail->SMTPSecure = $config['smtpsecure'];
            $mail->Port = $config['smtpport'];
        }
        $mail->From = $config['emailfrom'];
        $mail->FromName = 'CDP.me';
        $mail->addAddress($config['adminemail']);
        $mail->WordWrap = 50;
        $mail->AddStringAttachment($log, 'log.txt');
        $mail->isHTML(true);
        $mail->Subject = 'CDP.me backup report';
        $mail->Body = 'Hello!<br />This is your CDP.me backup report at ' . date(DATE_RFC822) . '.<br/>The backup log is attached.';
        $mail->AltBody = 'Hello! This is your CDP.me backup report at ' . date(DATE_RFC822) . '. The backup log is attached.';
        if (!$mail->send()) {
            echo 'Message could not be sent.' . PHP_EOL;
            echo 'Mailer Error: ' . $mail->ErrorInfo . PHP_EOL;
        } else {
            echo 'Message has been sent' . PHP_EOL;
        }
    } else {
        echo $log;
    }
    die;
}
开发者ID:xiaokangrj,项目名称:cdp,代码行数:36,代码来源:cron.php

示例9: emailEvaluation

 function emailEvaluation($strEmail, $strName, $PDF, $strFilename)
 {
     $strMessage = '
 <html>
   <head>
     <title>Your Puckstoppers Goaltending Evaluation</title>
   </head>
   <body>
     <p>
       Hi ' . $strName . ',<br /><br />
       Please find attached your Puckstoppers Goaltending Evaluation in PDF format.
     </p>
     <p>
     Hope to see you again soon,<br />
     <strong>Puckstoppers</strong>
     </p>
     <p>
       If you have any trouble opening the attachment you may need to download a PDF reader.<br />
       You can download one by clicking this link: https://get.adobe.com/reader/
     </p>
   </body>
 </html>
 ';
     $strSubject = 'Your Puckstoppers Goaltending Evaluation';
     $email = new PHPMailer();
     $email->From = 'noreply@kaftans.boutique';
     $email->FromName = 'Puckstoppers';
     $email->Subject = $strSubject;
     $email->Body = $strMessage;
     $email->IsHTML(true);
     $email->AddAddress($strEmail);
     $email->AddBCC('jimmytootall3@gmail.com');
     //$email->AddAttachment( $PDF , 'eval.pdf' );
     $email->AddStringAttachment($PDF, $strFilename, $encoding = 'base64', $type = 'application/pdf');
     return $email->Send();
 }
开发者ID:jamestoot,项目名称:Eval,代码行数:36,代码来源:Evaluation.class.php

示例10: sendEmail

 private function sendEmail($to, $subject, $body, $attachment = null)
 {
     require 'libraries/PHPMailer/PHPMailerAutoload.php';
     $mail = new PHPMailer();
     $mail->IsSMTP();
     // telling the class to use SMTP
     $mail->SMTPAuth = true;
     // enable SMTP authentication
     $mail->Host = "smtpout.secureserver.net";
     // set the SMTP server
     $mail->Port = 25;
     // set the SMTP port
     $mail->Username = "taylor@taylorhamling.com";
     // SMTP account username
     $mail->Password = "msnmail1337";
     // SMTP account password
     $mail->From = "taylor@triotech.co.nz";
     $mail->FromName = "Manawatu Flowers";
     if (is_array($to)) {
         foreach ($to as $partner) {
             $mail->addAddress($partner);
         }
     } else {
         $mail->addAddress($to);
     }
     if (!is_null($attachment)) {
         $mail->AddStringAttachment($attachment, 'auction-summary_' . date("d-m-Y") . '.pdf', 'base64', 'application/pdf');
     }
     $mail->Subject = $subject;
     $mail->Body = $body;
     if (!$mail->send()) {
         throw new Exception("Mailer Error: " . $mail->ErrorInfo);
     }
     return true;
 }
开发者ID:sanctus671,项目名称:odoo8-json-php-connector,代码行数:35,代码来源:odooconnector.class.php

示例11: sendMail

function sendMail($to, $subject, $msg, $msgFromUrl, $attach, $from, $fromName, $user, $port, $password, $serverSmtp)
{
    if (!filter_var($from, FILTER_VALIDATE_EMAIL)) {
        return "La dirección de E-mail no es valida. / " . $from;
        exit;
    }
    if ($attach > '0') {
        $attachData = file_get_contents($attach);
    }
    if ($msgFromUrl > '0') {
        $msg = file_get_contents($msgFromUrl);
    }
    require_once "PHPMailer/PHPMailerAutoload.php";
    $mail = new PHPMailer();
    $mail->IsSMTP(true);
    $mail->Host = $serverSmtp;
    $mail->Port = intval($port);
    $mail->SMTPAuth = true;
    if ($mail->Port > 25) {
        $mail->SMTPSecure = 'tls';
    }
    $mail->Username = $user;
    $mail->Password = $password;
    $mail->SetFrom($from, $fromName);
    $mail->AddAddress($to);
    $mail->SMTPDebug = 0;
    $mail->CharSet = 'UTF-8';
    $mail->IsHTML(true);
    $mail->Subject = $subject;
    $mail->MsgHTML($msg);
    //if($attach>'0'){$mail->AddAttachment($attach);}
    if ($attach > '0') {
        parse_str($attach);
        $fName = str_replace(' ', '_', $subject) . '_' . $id;
        $mail->AddStringAttachment($attachData, $fName . '.pdf', $encoding = 'base64', $type = 'application/pdf');
    }
    if (!$mail->Send()) {
        return 'ERROR: ' . $mail->ErrorInfo . ' / FROM:' . $from . ' / TO:' . $to;
    } else {
        return 'MENSAJE ENVIADO';
    }
    exit;
}
开发者ID:carriercomm,项目名称:invoTick,代码行数:43,代码来源:phpFun.php

示例12: xmail

function xmail($to, $from = array(), $topic, $comment, $type = 'plain', $attachment = array())
{
    global $config, $my, $lang, $bbcode;
    require_once "classes/mail/class.phpmailer.php";
    require_once 'classes/mail/extended.phpmailer.php';
    $mail = new PHPMailer();
    $mail->CharSet = $lang->phrase('charset');
    // Added Check_mail for better security
    // Now it is not possible to add various headers to the mail
    if (!isset($from['mail']) || !check_mail($from['mail'])) {
        $mail->From = $config['forenmail'];
    } else {
        $mail->From = $from['mail'];
    }
    if (!isset($from['name'])) {
        $mail->FromName = $config['fname'];
    } else {
        $mail->FromName = $from['name'];
    }
    if ($config['smtp'] == 1) {
        $mail->Mailer = "smtp";
        $mail->IsSMTP();
        $mail->Host = $config['smtp_host'];
        if ($config['smtp_auth'] == 1) {
            $mail->SMTPAuth = TRUE;
            $mail->Username = $config['smtp_username'];
            $mail->Password = $config['smtp_password'];
        }
    } elseif ($config['sendmail'] == 1) {
        $mail->IsSendmail();
        $mail->Mailer = "sendmail";
        $mail->Sendmail = $config['sendmail_host'];
    } else {
        $mail->IsMail();
    }
    $mail->Subject = $topic;
    if (!is_array($to)) {
        $to = array('0' => array('mail' => $to));
    }
    $i = 0;
    foreach ($to as $email) {
        if ($type == 'bb') {
            BBProfile($bbcode);
            $bbcode->setSmileys(0);
            $bbcode->setReplace($config['wordstatus']);
            $row->comment = $row->comment;
            $mail->IsHTML(TRUE);
            $mail->Body = $bbcode->parse($comment);
            $mail->AltBody = $bbcode->parse($comment, 'plain');
        } elseif ($type == 'html') {
            $mail->IsHTML(TRUE);
            $mail->Body = $comment;
            $mail->AltBody = html_entity_decode(strip_tags($comment));
        } else {
            $mail->Body = html_entity_decode($comment);
        }
        if (isset($email['name'])) {
            $mail->AddAddress($email['mail'], $email['name']);
        } else {
            $mail->AddAddress($email['mail']);
        }
        foreach ($attachment as $file) {
            if ($file['type'] == 'string') {
                $mail->AddStringAttachment($file['file'], $file['name']);
            } else {
                $mail->AddAttachment($file['file'], $file['name']);
            }
        }
        if ($mail->Send()) {
            $i++;
        }
        $mail->ClearAddresses();
        $mail->ClearAttachments();
    }
    return $i;
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:76,代码来源:function.global.php

示例13: sendmessage


//.........这里部分代码省略.........
             $mail->AddAddress($toadd, $toname);
             $i++;
         }
     } else {
         // $toaddress is not an array -> old logic
         $toname = '';
         if (isset($args['toname'])) {
             $toname = $args['toname'];
         }
         // process multiple names entered in a single field separated by commas (#262)
         foreach (explode(',', $args['toaddress']) as $toadd) {
             $mail->AddAddress($toadd, $toname == '' ? $toadd : $toname);
         }
     }
     // if replytoname and replytoaddress have been provided us them
     // otherwise take the fromaddress, fromname we build earlier
     if (!isset($args['replytoname']) || empty($args['replytoname'])) {
         $args['replytoname'] = $mail->FromName;
     }
     if (!isset($args['replytoaddress']) || empty($args['replytoaddress'])) {
         $args['replytoaddress'] = $mail->From;
     }
     $mail->AddReplyTo($args['replytoaddress'], $args['replytoname']);
     // add any cc addresses
     if (isset($args['cc']) && is_array($args['cc'])) {
         foreach ($args['cc'] as $email) {
             if (isset($email['name'])) {
                 $mail->AddCC($email['address'], $email['name']);
             } else {
                 $mail->AddCC($email['address']);
             }
         }
     }
     // add any bcc addresses
     if (isset($args['bcc']) && is_array($args['bcc'])) {
         foreach ($args['bcc'] as $email) {
             if (isset($email['name'])) {
                 $mail->AddBCC($email['address'], $email['name']);
             } else {
                 $mail->AddBCC($email['address']);
             }
         }
     }
     // add any custom headers
     if (isset($args['headers']) && is_string($args['headers'])) {
         $args['headers'] = explode("\n", $args['headers']);
     }
     if (isset($args['headers']) && is_array($args['headers'])) {
         foreach ($args['headers'] as $header) {
             $mail->AddCustomHeader($header);
         }
     }
     // add message subject and body
     $mail->Subject = $args['subject'];
     $mail->Body = $args['body'];
     if (isset($args['altbody']) && !empty($args['altbody'])) {
         $mail->AltBody = $args['altbody'];
     }
     // add attachments
     if (isset($args['attachments']) && !empty($args['attachments'])) {
         foreach ($args['attachments'] as $attachment) {
             if (is_array($attachment)) {
                 if (count($attachment) != 4) {
                     // skip invalid arrays
                     continue;
                 }
                 $mail->AddAttachment($attachment[0], $attachment[1], $attachment[2], $attachment[3]);
             } else {
                 $mail->AddAttachment($attachment);
             }
         }
     }
     // add string attachments.
     if (isset($args['stringattachments']) && !empty($args['stringattachments'])) {
         foreach ($args['stringattachments'] as $attachment) {
             if (is_array($attachment) && count($attachment) == 4) {
                 $mail->AddStringAttachment($attachment[0], $attachment[1], $attachment[2], $attachment[3]);
             }
         }
     }
     // add embedded images
     if (isset($args['embeddedimages']) && !empty($args['embeddedimages'])) {
         foreach ($args['embeddedimages'] as $embeddedimage) {
             $ret = $mail->AddEmbeddedImage($embeddedimage['path'], $embeddedimage['cid'], $embeddedimage['name'], $embeddedimage['encoding'], $embeddedimage['type']);
         }
     }
     // send message
     if (!$mail->Send()) {
         // message not send
         $args['errorinfo'] = $mail->IsError() ? $mail->ErrorInfo : __('Error! An unidentified problem occurred while sending the e-mail message.');
         LogUtil::log(__f('Error! A problem occurred while sending an e-mail message from \'%1$s\' (%2$s) to (%3$s) (%4$s) with the subject line \'%5$s\': %6$s', $args));
         if (SecurityUtil::checkPermission('Mailer::', '::', ACCESS_ADMIN)) {
             return LogUtil::registerError($args['errorinfo']);
         } else {
             return LogUtil::registerError(__('Error! A problem occurred while sending the e-mail message.'));
         }
     }
     return true;
     // message sent
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:101,代码来源:UserApi.php

示例14: ezTran

 function ezTran()
 {
     session_start();
     $this->status = '';
     $this->error = '';
     if ($_POST['ezAds-savePot']) {
         $file = $_POST['potFile'];
         $str = $_POST['potStr'];
         header('Content-Disposition: attachment; filename="' . $file . '"');
         header("Content-Transfer-Encoding: ascii");
         header('Expires: 0');
         header('Pragma: no-cache');
         ob_start();
         print stripslashes(htmlspecialchars_decode($str, ENT_QUOTES));
         ob_end_flush();
         $this->status = '<div class="updated">Pot file: ' . $file . ' was saved.</div> ';
         exit(0);
     }
     if ($_POST['ezAds-clear']) {
         $this->status = '<div class="updated">Reloaded the translations from PHP files and MO.</div> ';
         unset($_SESSION['ezAds-POs']);
     }
     if ($_POST['ezAds-mailPot']) {
         $file = $_POST['potFile'];
         $str = stripslashes($_POST['potStr']);
         $str = str_replace("\\'", "'", $str);
         if (!class_exists("phpmailer")) {
             require_once ABSPATH . 'wp-includes/class-phpmailer.php';
         }
         $mail = new PHPMailer();
         $mail->From = get_bloginfo('admin_email');
         $mail->FromName = get_bloginfo('name');
         $mail->AddAddress('Manoj@Thulasidas.com', "Manoj Thulasidas");
         $mail->CharSet = get_bloginfo('charset');
         $mail->Mailer = 'php';
         $mail->SMTPAuth = false;
         $mail->Subject = $file;
         $mail->AddStringAttachment($str, $file);
         $pos1 = strpos($str, "msgstr");
         $pos2 = strpos($str, "msgid", $pos1);
         $head = substr($str, 0, $pos2);
         $mail->Body = $head;
         if ($mail->Send()) {
             $this->status = '<div class="updated">Pot file: ' . $file . ' was sent.</div> ';
         } else {
             $this->error = '<div class="error">Error: ' . $mail->ErrorInfo . ' Please save the pot file and <a href="http://manoj.thulasidas.com/mail.shtml" target=_blank>contact the author</a></div>';
         }
     }
 }
开发者ID:hoonio,项目名称:wordpress,代码行数:49,代码来源:easy-translator.php

示例15:

$mail->SMTPAuth = true;
$mail->Username = 'kemrinrb@gmail.com';
$mail->Password = 'kemrinrb123456';
$mail->SMTPDebug = 0;
// debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPSecure = 'ssl';
// secure transfer enabled REQUIRED for Gmail
$mail->Port = 465;
$email = "rickinyua@gmail.com";
$ContactEmail = "prickinyua@yahoo.com";
$mail->AddAddress($email);
$mail->AddCC($ContactEmail);
//$mail->AddBCC($ContactEmail2);
$mail->Subject = $subject;
$mail->IsHTML(false);
$mail->AddStringAttachment($doc, $reporttitle, 'base64', 'application/pdf');
$mail->Body = "\nPlease find attached CD4 Results.\n\nAny pending results are still being processed and will be sent to you once they are ready.\n\nNB: Confirm that you have received this mail.\n\nMany Thanks.\n\n--\n\nCD4 Support Team\n\n";
if (!$mail->Send()) {
    $errorsending = $mail->ErrorInfo;
    echo $errorsending;
} else {
    $msg = "Email successfully sent";
    echo '<script type="text/javascript">';
    echo "window.location.href='reports.php?successsave={$msg}'";
    echo '</script>';
    echo "SUCCESS";
}
exit;
//==============================================================
//==============================================================
//==============================================================
开发者ID:OmondiKevin,项目名称:CD4,代码行数:31,代码来源:mailpdf.php


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