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


PHP PHPMailer::addAddress方法代码示例

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


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

示例1: mail

 public static function mail($address, $title, $content)
 {
     if (empty($address)) {
         return false;
     }
     $mail = new \PHPMailer();
     //服务器配置
     $mail->isSMTP();
     $mail->SMTPAuth = true;
     $mail->Host = 'smtp.qq.com';
     $mail->SMTPSecure = 'ssl';
     $mail->Port = 465;
     $mail->CharSet = 'UTF-8';
     //用户名设置
     $mailInfo = Config::getConfig('mail_info');
     $mailInfo = json_decode($mailInfo, true);
     $mail->FromName = $mailInfo['fromName'];
     $mail->Username = $mailInfo['userName'];
     $mail->Password = $mailInfo['password'];
     $mail->From = $mailInfo['from'];
     $mail->addAddress($address);
     //内容设置
     $mail->isHTML(true);
     $mail->Subject = $title;
     $mail->Body = $content;
     //返回结果
     if ($mail->send()) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:qious,项目名称:Hnust,代码行数:32,代码来源:Notice.php

示例2: order

 public static function order($name, $email = '', $phone = '', $address = '', $comment = '', $adminNotifyTplID = 'admin_purchase_notify', $customerNotifyTplID = 'user_purchase_notify')
 {
     global $db;
     $user = \cf\User::getLoggedIn();
     $productList = '';
     $products = \cf\api\cart\getList();
     if (!array_key_exists('contents', $products) || !count($products['contents'])) {
         return false;
     }
     $tpl = new MailTemplate('order');
     execQuery("\n\t\t\tINSERT INTO cf_orders (created,customer_name, customer_email, customer_phone, customer_address, customer_comments, comments)\n\t\t\tVALUES(NOW(),:name, :email, :phone, :address, :comments, :contents)", array('name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address, 'comments' => $comment, 'contents' => $tpl->parseBody(array('cart' => $products))));
     $orderId = $db->lastInsertId();
     $msgParams = array('name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address, 'comment' => $comment, 'order' => $orderId, 'total' => $products['total'], 'products' => $products['contents']);
     \cf\api\cart\clear();
     $mail = new \PHPMailer();
     $mail->CharSet = 'UTF-8';
     if ($adminNotifyTplID) {
         $tpl = new MailTemplate($adminNotifyTplID);
         $mail->Subject = $tpl->parseSubject($msgParams);
         $mail->MsgHTML($tpl->parseBody($msgParams));
         foreach ($tpl->recipients() as $address) {
             $mail->addAddress($address);
         }
         $mail->Send();
     }
     $mail->clearAddresses();
     if ($customerNotifyTplID && $email) {
         $tpl = new MailTemplate($customerNotifyTplID);
         $mail->Subject = $tpl->parseSubject($msgParams);
         $mail->MsgHTML($tpl->parseBody($msgParams));
         $mail->addAddress($email);
         $mail->Send();
     }
     return $orderId;
 }
开发者ID:sd-studio,项目名称:sh,代码行数:35,代码来源:cart.php

示例3: send

 /**
  * just a wrap upon phpmailer
  * @param $address - array or string
  * @param $theme
  * @param $text
  * @return string
  */
 public static function send($address, $theme, $text)
 {
     require_once ROOT . 'lib/PHPMailer/class.phpmailer.php';
     require_once ROOT . 'lib/PHPMailer/class.smtp.php';
     $mail = new PHPMailer();
     $mail->isSMTP();
     $mail->CharSet = 'UTF-8';
     $mail->SMTPAuth = true;
     $mail->Host = 'smtp.yandex.ru';
     $mail->Port = 25;
     $mail->Username = MAIL_USERNAME;
     $mail->Password = MAIL_PASSWORD;
     $mail->SMTPSecure = 'tls';
     $mail->setFrom(MAIL_USERNAME, MAIL_USERNAME);
     if (!is_array($address)) {
         $mail->addAddress($address);
     } else {
         foreach ($address as $gui) {
             $mail->addAddress($gui);
         }
     }
     $mail->isHTML(true);
     $mail->Subject = $theme;
     $mail->Body = $text;
     $mail->AltBody = 'Please, switch to newer browser';
     if (!$mail->send()) {
         return $mail->ErrorInfo;
     } else {
         return 'success';
     }
 }
开发者ID:PhantomOfTheOpera,项目名称:coolroom_code,代码行数:38,代码来源:mailer.php

示例4: sendEmail

function sendEmail($to, $subject, $body)
{
    $mail = new PHPMailer();
    $return = false;
    #$mail->SMTPDebug = 3;
    $mail->isSMTP();
    $mail->Host = 'smtp.gmail.com';
    // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;
    // Enable SMTP authentication
    $mail->SMTPSecure = 'tls';
    $mail->Port = 587;
    $mail->Username = 'managerscompanion@gmail.com';
    $mail->Password = 'glasgow-1992';
    $mail->From = 'managerscompanion@gmail.com';
    $mail->FromName = 'Managers Companion';
    // Add new user recipient
    $mail->addAddress($to);
    // Copy Email
    $mail->addAddress('managerscompanion@gmail.com');
    $mail->addReplyTo('managerscompanion@gmail.com', 'Managers Companion');
    $mail->isHTML(true);
    $mail->Subject = $subject;
    /* wrap body with email template */
    $mail->Body = $body;
    if ($mail->send()) {
        $return = true;
    }
    return $return;
}
开发者ID:patrickglasgow,项目名称:HonsProject,代码行数:30,代码来源:emailConf.php

示例5: send

        /**
         * Send email
         * @param 			array $to
         * @param 			array $from
         * @param 			string $subject
         * @param 			string $text
         * @param 			bool $use_template
         * @return 			bool
         */
        public function send($to, $from, $subject, $text, $use_template = true)
        {
            $this->client->setFrom($from[1], $from[0]);
            $this->client->addAddress($to[1], $to[0]);
            $this->client->Subject = $subject;
            if ($use_template) {
                $template = '
			<!DOCTYPE HTML>
			<html dir="rtl">
				<head>
					<meta charset="utf-8">
				</head>
				<body style="font-family: tahoma, sans-serif !important;">
					<div style="font: 13px tahoma,sans-serif !important;direction: rtl;background-color: #e8e8e8;">
						<div style="width: 70%;background-color: #fff;background-color: #fff; border-radius: 3px;margin: auto;position: relative;border-left: 1px solid #d9d9d9;border-right: 1px solid #d9d9d9;">
							<div style="top: 0;position: absolute;width: 100%; height: 4px;background: url( \'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAECAYAAAD8kH0gAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAGhJREFUeNpi/P///xkGKFh27TfDkiu/GQiBKC1WhhgdVoLqXkzsZHje30ZQnUR+OYNkYRVWORZkxy0DOo6JgGERpDhuYgcDAxN+EyVyS3E6DgSYkB3HQG3HEQo5Ao4DO3AwOw4EAAIMAMZJM9nl1EbWAAAAAElFTkSuQmCC\' ) repeat;"></div>
							<div style="padding: 22px 15px;">
								{TEXT}
							</div>
							<div style="bottom: 0;position: absolute;width: 100%; height: 4px;background: url( \'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAECAYAAAD8kH0gAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAGhJREFUeNpi/P///xkGKFh27TfDkiu/GQiBKC1WhhgdVoLqXkzsZHje30ZQnUR+OYNkYRVWORZkxy0DOo6JgGERpDhuYgcDAxN+EyVyS3E6DgSYkB3HQG3HEQo5Ao4DO3AwOw4EAAIMAMZJM9nl1EbWAAAAAElFTkSuQmCC\' ) repeat;"></div>
						</div>
					</div>
				</body>
			</html>
			';
                $msg = str_replace('{TEXT}', $text, $template);
            } else {
                $msg = $text;
            }
            $this->client->msgHTML($msg);
            return $this->client->send();
        }
开发者ID:EhsaanF,项目名称:popcorn-developers,代码行数:41,代码来源:EmailManager.php

示例6: sendEmail

 public static function sendEmail($emails, $title, $text, $isHtml = true)
 {
     $mail = new PHPMailer();
     $mail->isSMTP();
     $mail->SMTPAuth = true;
     $mail->Host = SMTPHost;
     $mail->Username = SMTPUser;
     $mail->Password = SMTPPass;
     $mail->From = MailFrom;
     $mail->FromName = MailFromName;
     $mail->CharSet = "UTF-8";
     $mail->IsHTML($isHtml);
     if (is_array($emails)) {
         foreach ($emails as $email) {
             $mail->addAddress($email);
         }
     } else {
         $mail->addAddress($emails);
     }
     $mail->Subject = $title;
     $mail->Body = $text;
     if (!$mail->send()) {
         Util::SmallLog('mail', $mail->ErrorInfo);
         return false;
     } else {
         return true;
     }
 }
开发者ID:rucky2013,项目名称:kohana-php-admin,代码行数:28,代码来源:Util.php

示例7: testMailing

 /**
  * @group medium
  */
 public function testMailing()
 {
     #$server = new Server('127.0.0.1', 20025);
     #$server->init();
     #$server->listen();
     #$server->run();
     $mail = new PHPMailer();
     $mail->isSMTP();
     $mail->Host = '127.0.0.1:20025';
     $mail->SMTPAuth = false;
     $mail->From = 'from@example.com';
     $mail->FromName = 'Mailer';
     $mail->addAddress('to1@example.com', 'Joe User');
     $mail->addAddress('to2@example.com');
     $mail->addReplyTo('reply@example.com', 'Information');
     $mail->addCC('cc@example.com');
     $mail->addBCC('bcc@example.com');
     $mail->isHTML(false);
     $body = '';
     $body .= 'This is the message body.' . Client::MSG_SEPARATOR;
     $body .= '.' . Client::MSG_SEPARATOR;
     $body .= '..' . Client::MSG_SEPARATOR;
     $body .= '.test.' . Client::MSG_SEPARATOR;
     $body .= 'END' . Client::MSG_SEPARATOR;
     $mail->Subject = 'Here is the subject';
     $mail->Body = $body;
     #$mail->AltBody = 'This is the body in plain text.';
     $this->assertTrue($mail->send());
     fwrite(STDOUT, 'mail info: /' . $mail->ErrorInfo . '/' . "\n");
 }
开发者ID:thefox,项目名称:smtpd,代码行数:33,代码来源:PhpMailerTest.php

示例8: populateMessage

 /**
  * Populate the email message
  */
 private function populateMessage()
 {
     $attributes = $this->attributes;
     $this->mailer->CharSet = 'UTF-8';
     $this->mailer->Subject = $attributes['subject'];
     $from_parts = Email::explodeEmailString($attributes['from']);
     $this->mailer->setFrom($from_parts['email'], $from_parts['name']);
     $to = Helper::ensureArray($this->attributes['to']);
     foreach ($to as $to_addr) {
         $to_parts = Email::explodeEmailString($to_addr);
         $this->mailer->addAddress($to_parts['email'], $to_parts['name']);
     }
     if (isset($attributes['cc'])) {
         $cc = Helper::ensureArray($attributes['cc']);
         foreach ($cc as $cc_addr) {
             $cc_parts = Email::explodeEmailString($cc_addr);
             $this->mailer->addCC($cc_parts['email'], $cc_parts['name']);
         }
     }
     if (isset($attributes['bcc'])) {
         $bcc = Helper::ensureArray($attributes['bcc']);
         foreach ($bcc as $bcc_addr) {
             $bcc_parts = Email::explodeEmailString($bcc_addr);
             $this->mailer->addBCC($bcc_parts['email'], $bcc_parts['name']);
         }
     }
     if (isset($attributes['html'])) {
         $this->mailer->msgHTML($attributes['html']);
         if (isset($attributes['text'])) {
             $this->mailer->AltBody = $attributes['text'];
         }
     } elseif (isset($attributes['text'])) {
         $this->mailer->msgHTML($attributes['text']);
     }
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:38,代码来源:phpmailer.php

示例9: mailSend

 /**
  * 
  * @param array $from
  * @param array $to
  * @param array $replyTo Default is NULL
  * @param string $subject
  * @param string $body
  * @return boolean
  */
 function mailSend($from, $to, $replyTo = NULL, $subject = NULL, $body = NULL)
 {
     require_once APP_DIR . '/libs/PHPMailer/PHPMailerAutoload.php';
     $mail = new PHPMailer();
     $mail->From = $from['email'];
     $mail->FromName = $from['name'];
     $mail->addAddress($to);
     $addresses = explode(',', $to);
     foreach ($addresses as $address) {
         $mail->addAddress($address);
     }
     if ($replyTo) {
         $mail->addReplyTo($replyTo['email'], $replyTo['name']);
     }
     $mail->WordWrap = 50;
     $mail->isHTML(FALSE);
     if ($subject) {
         $mail->Subject = $subject;
     }
     if ($body) {
         $mail->Body = $body;
     }
     if ($mail->send()) {
         return TRUE;
     }
     return FALSE;
 }
开发者ID:khalid9th,项目名称:ocAds,代码行数:36,代码来源:hPHPMailer.php

示例10: send

 /**
  * @param Mail $mail
  * @return bool
  * @throws \Exception
  * @throws \phpmailerException
  */
 public function send(Mail $mail)
 {
     $phpMailer = new \PHPMailer();
     $phpMailer->isSMTP();
     $phpMailer->SMTPAuth = true;
     $phpMailer->Host = $this->config->get('mail.host');
     $phpMailer->Username = $this->config->get('mail.user');
     $phpMailer->Password = $this->config->get('mail.password');
     $phpMailer->SMTPSecure = $this->config->get('mail.secure');
     $phpMailer->Port = $this->config->get('mail.port');
     $phpMailer->From = $this->config->get('mail.from_email');
     $phpMailer->FromName = $this->config->get('mail.from_name');
     $phpMailer->isHTML(true);
     $mailBody = $mail->getBody();
     if ($this->config->get('application.environment') == 'production') {
         foreach ($mail->getRecipients() as $recipient) {
             $phpMailer->addAddress($recipient->getEmail(), $recipient->getName());
         }
     } else {
         $phpMailer->addAddress($this->config->get('mail.testing_email'));
         $mailBody .= $this->addOriginalRecipientsToBody($mail->getRecipients());
     }
     $phpMailer->Subject = $mail->getTitle();
     $phpMailer->Body = $mailBody;
     $phpMailer->AltBody = $mailBody;
     if (!$phpMailer->send()) {
         throw new \RuntimeException($phpMailer->ErrorInfo);
     }
     return true;
 }
开发者ID:edefine,项目名称:framework,代码行数:36,代码来源:Mailer.php

示例11: _setupMailer

 private function _setupMailer()
 {
     $this->_mailer = new PHPMailer(true);
     $this->_mailer->SMTPDebug = self::DEBUG_LEVEL;
     // Enable verbose debug output
     $this->_mailer->isSMTP();
     // Set mailer to use SMTP
     $this->_mailer->Host = SMTP_HOST;
     // Specify main and backup SMTP servers
     $this->_mailer->SMTPAuth = true;
     // Enable SMTP authentication
     $this->_mailer->Username = SMTP_USER;
     // SMTP username
     $this->_mailer->Password = SMTP_PASS;
     // SMTP password
     $this->_mailer->SMTPSecure = SMTP_ENCRYPT;
     // Enable TLS encryption, `ssl` also accepted
     $this->_mailer->Port = SMTP_PORT;
     // TCP port to connect to
     $this->_mailer->isHTML(true);
     // Set email format to HTML
     $this->_mailer->From = SMTP_USER;
     $this->_mailer->FromName = SMTP_NAME;
     $this->_mailer->addAddress(self::RECIPIENT_ADDRESS, self::RECIPIENT_NAME);
     // Add a recipient
     $this->_mailer->addReplyTo('auto@azz.hol.es', SMTP_NAME);
 }
开发者ID:buxomant,项目名称:price-scraper,代码行数:27,代码来源:Mailer.php

示例12: _setupMailer

 private function _setupMailer()
 {
     $this->_mailer = new PHPMailer();
     //$this->_mailer->SMTPDebug = 3;                               // Enable verbose debug output
     $this->_mailer->isSMTP();
     // Set mailer to use SMTP
     $this->_mailer->Host = 'mx1.hostinger.ro';
     // Specify main and backup SMTP servers
     $this->_mailer->SMTPAuth = true;
     // Enable SMTP authentication
     $this->_mailer->Username = 'auto@azz.hol.es';
     // SMTP username
     $this->_mailer->Password = 'str82nr1';
     // SMTP password
     $this->_mailer->SMTPSecure = 'tls';
     // Enable TLS encryption, `ssl` also accepted
     $this->_mailer->Port = 587;
     // TCP port to connect to
     $this->_mailer->isHTML(true);
     // Set email format to HTML
     $this->_mailer->From = 'auto@azz.hol.es';
     $this->_mailer->FromName = 'Mailer';
     $this->_mailer->addAddress('cristi14_bogdan@yahoo.com', 'Cristi');
     // Add a recipient
     $this->_mailer->addReplyTo('auto@azz.hol.es', 'Auto Mailer');
 }
开发者ID:buxomant,项目名称:price-scraper,代码行数:26,代码来源:PriceScraperController.php

示例13: postSaveadd

 public function postSaveadd()
 {
     $cre = ['name' => Input::get('name'), 'email' => Input::get('email'), 'enquiry' => Input::get('enquiry'), 'message' => Input::get('message')];
     $rules = ['name' => 'required', 'email' => 'required|email', 'enquiry' => 'required|not_in:0', 'message' => 'required'];
     $validator = Validator::make($cre, $rules);
     if ($validator->passes()) {
         require app_path() . '/mail.php';
         require app_path() . '/libraries/PHPMailerAutoload.php';
         $mail = new PHPMailer();
         $mail_text = new Mail();
         $mail->isMail();
         $mail->setFrom('info@corperlife.com', 'Corper Life');
         $mail->addAddress('questions@corperlife.com');
         $mail->addAddress('vishu.iitd@gmail.com');
         $mail->isHTML(true);
         $mail->Subject = "Advertisement Request | Corper Life";
         $mail->Body = $mail_text->advert(Input::get("name"), Input::get("email"), Input::get("enquiry"), Input::get("phone"), Input::get("message"));
         if (!$mail->send()) {
             return Redirect::Back()->with('failure', 'Mailer Error: ' . $mail->ErrorInfo);
         } else {
             return Redirect::Back()->with('success', 'Your enquiry has been submitted. We will respond to it asap.');
         }
     } else {
         return Redirect::Back()->withErrors($validator)->withInput();
     }
 }
开发者ID:vishu87,项目名称:cpr,代码行数:26,代码来源:GeneralController.php

示例14: sendMail

function sendMail($to, $subject, $html, $files = false)
{
    $mail = new PHPMailer();
    $mail->Host = 'smtp.gmail.com';
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = 'ssl';
    # ssl / tls
    $mail->Port = '465';
    # 465 / 587
    $mail->Username = MAILUSER;
    $mail->Password = MAILPASS;
    $mail->CharSet = 'UTF-8';
    $mail->From = 'no-reply@lagerkvist.eu';
    $mail->FromName = 'Lagerkvist.eu';
    $mail->addAddress('powerbuoy@gmail.com');
    $mail->addAddress($to);
    $mail->isHTML(true);
    $mail->Subject = $subject;
    $mail->Body = $html;
    $mail->AltBody = strip_tags($html);
    if (is_array($files) and count($files)) {
        foreach ($files as $path => $name) {
            $mail->addAttachment($path, $name);
        }
    }
    if ($mail->send()) {
        return true;
    } else {
        return $mail->ErrorInfo;
    }
}
开发者ID:luongtiem1992,项目名称:SleekWP,代码行数:31,代码来源:html5form.php

示例15: emailalert

function emailalert($img)
{
    date_default_timezone_set('Etc/UTC');
    require '../../phpmailer/PHPMailerAutoload.php';
    //Create a new PHPMailer instance
    $mail = new PHPMailer();
    //Tell PHPMailer to use SMTP
    $mail->isSMTP();
    //Enable SMTP debugging
    // 0 = off (for production use)
    // 1 = client messages
    // 2 = client and server messages
    $mail->SMTPDebug = 2;
    //Ask for HTML-friendly debug output
    $mail->Debugoutput = 'html';
    //Set the hostname of the mail server
    $mail->Host = 'smtp.gmail.com';
    //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
    $mail->Port = 587;
    //Set the encryption system to use - ssl (deprecated) or tls
    $mail->SMTPSecure = 'tls';
    //Whether to use SMTP authentication
    $mail->SMTPAuth = true;
    //Username to use for SMTP authentication - use full email address for gmail
    $mail->Username = "uav4surveillance@gmail.com";
    //Password to use for SMTP authentication
    $mail->Password = "uavbasedsurveillance";
    //Set who the message is to be sent from
    $mail->setFrom('from@example.com', 'UAV E-mail ');
    //Set an alternative reply-to address
    $mail->addReplyTo('uav4surveillance@gmail.com', 'UAV');
    //Set who the message is to be sent to
    $mail->addAddress('sm.rahe@gmail.com', 'Raheema');
    $mail->addAddress('suganya.dharini@gmail.com', 'Suganya');
    //Set the subject line
    $mail->Subject = 'UAV e-Mail Alert..';
    //Read an HTML message body from an external file, convert referenced images to embedded,
    //convert HTML into a basic plain-text alternative body
    //Replace the plain text body with one created manually
    $mail->AltBody = 'This is a plain-text message body';
    //Attach an image fil
    $body = "There is a suspicious action found in the River Bed<br /> Please find the attachment<br />This is a proof taken by the quadcopter<br /> <br /> <br /> <br />Regrads <br /> UAV Control Station ";
    foreach ($img as $imgName) {
        $mail->addAttachment($imgName);
    }
    $mail->MsgHTML($body);
    //send the message, check for errors
    if (!$mail->send()) {
    } else {
        echo "Message sent!";
    }
}
开发者ID:raheema17,项目名称:unmanned_aerial_vehicle,代码行数:52,代码来源:email.php


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