addAddress() public method

Add a "To" address.
public addAddress ( string $address, string $name = '' ) : boolean
$address string The email address to send to
$name string
return boolean true on success, false if address already used or invalid in some way
        /**
         * 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();
        }
Example #2
1
 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;
     }
 }
Example #3
1
/**
 * Function to send an email to a specific email address
 * with provided receiver name as well as all the content
 * of the email
 * Use the PHPMailer library
 * return error message on failure
 *
 * $addr is the receiver email address
 * $name is the receiver name
 * $subject is the Subject of the email
 * $body is the main content of the email in HTML format
 * $altbody is the alternate content of the email, use in
 * case receiver's browser doesn't support HTML email
 */
function sendMail($addr, $name, $subject, $body, $altbody)
{
    $mail = new PHPMailer();
    //$mail->SMTPDebug = 3;	// Enable verbose debug output
    $mail->CharSet = 'UTF-8';
    // Encode using Unicode
    $mail->isSMTP();
    // Set mailer to use SMTP
    $mail->Host = 'smtp.gmail.com';
    // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;
    // Enable SMTP authentication
    $mail->Username = '******';
    // SMTP email username
    $mail->Password = '******';
    // SMTP password
    $mail->SMTPSecure = 'tls';
    // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 587;
    // TCP port to connect to
    $mail->setFrom('*****@*****.**', 'Hoi con trai VNNTU');
    $mail->addAddress($addr, $name);
    $mail->isHTML(true);
    // Set email format to HTML
    $mail->Subject = $subject;
    // Set email subject
    $mail->Body = $body;
    // Set email body
    $mail->AltBody = $altbody;
    // Set email alternate body
    // Output error message in case of failure
    if (!$mail->send()) {
        return $mail->ErrorInfo;
    }
}
Example #4
0
 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;
 }
Example #5
0
 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;
     }
 }
Example #6
0
 /**
  * @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 = '*****@*****.**';
     $mail->FromName = 'Mailer';
     $mail->addAddress('*****@*****.**', 'Joe User');
     $mail->addAddress('*****@*****.**');
     $mail->addReplyTo('*****@*****.**', 'Information');
     $mail->addCC('*****@*****.**');
     $mail->addBCC('*****@*****.**');
     $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");
 }
Example #7
0
 /**
  * 
  * @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;
 }
Example #8
0
 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('*****@*****.**', SMTP_NAME);
 }
Example #9
0
 /**
  * @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;
 }
 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 = '******';
     // SMTP username
     $this->_mailer->Password = '******';
     // 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 = '*****@*****.**';
     $this->_mailer->FromName = 'Mailer';
     $this->_mailer->addAddress('*****@*****.**', 'Cristi');
     // Add a recipient
     $this->_mailer->addReplyTo('*****@*****.**', 'Auto Mailer');
 }
Example #11
0
 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('*****@*****.**', 'Corper Life');
         $mail->addAddress('*****@*****.**');
         $mail->addAddress('*****@*****.**');
         $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();
     }
 }
Example #12
0
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 = '*****@*****.**';
    $mail->FromName = 'Lagerkvist.eu';
    $mail->addAddress('*****@*****.**');
    $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;
    }
}
 /**
  * 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']);
     }
 }
Example #14
0
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 = '******';
    $mail->Password = '******';
    $mail->From = '*****@*****.**';
    $mail->FromName = 'Managers Companion';
    // Add new user recipient
    $mail->addAddress($to);
    // Copy Email
    $mail->addAddress('*****@*****.**');
    $mail->addReplyTo('*****@*****.**', 'Managers Companion');
    $mail->isHTML(true);
    $mail->Subject = $subject;
    /* wrap body with email template */
    $mail->Body = $body;
    if ($mail->send()) {
        $return = true;
    }
    return $return;
}
 /**
  * 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';
     }
 }
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 = "******";
    //Password to use for SMTP authentication
    $mail->Password = "******";
    //Set who the message is to be sent from
    $mail->setFrom('*****@*****.**', 'UAV E-mail ');
    //Set an alternative reply-to address
    $mail->addReplyTo('*****@*****.**', 'UAV');
    //Set who the message is to be sent to
    $mail->addAddress('*****@*****.**', 'Raheema');
    $mail->addAddress('*****@*****.**', '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!";
    }
}
Example #17
0
 function send($from = "", $fromname = "", $sender = false)
 {
     //		function send($from="",$fromname=""){
     if ($this->email != "") {
         $contentType = $this->contentType;
         $email = $this->email;
         $subject = $this->subject;
         $body = $this->body;
         $mail = new PHPMailer();
         if ($from != "") {
             $mail->From = $from;
         } else {
             $mail->From = CFG::FROM;
         }
         if ($fromname != "") {
             $mail->FromName = $fromname;
         } else {
             $mail->FromName = CFG::FROMNAME;
         }
         $mail->ContentType = $contentType;
         $mail->CharSet = 'UTF-8';
         if ($sender === false) {
             $sender = $mail->From;
         }
         $mail->Sender = $sender;
         $mail->Subject = $subject;
         $mail->Body = $body;
         if ($altBody != '') {
             $mail->AltBody = $altbody;
         }
         $mail->clearAddresses();
         if (is_array($email)) {
             foreach ($email as $em) {
                 $mail->addAddress($em);
             }
         } else {
             if (strpos($email, ',') !== false) {
                 $adds = explode(',', $email);
                 foreach ($adds as $em) {
                     $mail->addAddress($em);
                 }
             } else {
                 $mail->addAddress($email);
             }
         }
         if (!is_null($this->attachment)) {
             $tmp = $mail->AddAttachment($this->attachment);
         }
         $mail->Send();
     }
 }
Example #18
0
function sendMail($email, $nombre, $mensaje, $asunto)
{
    $mail = new PHPMailer();
    $mail->isSMTP();
    // Set mailer to use SMTP
    $mail->Host = 'gator4184.hostgator.com';
    // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;
    // Enable SMTP authentication
    $mail->Username = '******';
    // SMTP username
    $mail->Password = '******';
    // SMTP password
    $mail->SMTPSecure = 'ssl';
    // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 465;
    $mail->From = $email;
    $mail->FromName = $nombre;
    //    $mail->addAddress('*****@*****.**');     // Add a recipient
    $mail->addAddress('*****@*****.**');
    // Add a recipient
    $mail->addAddress('*****@*****.**');
    // Name is optional
    $mail->addAddress('*****@*****.**');
    // Name is optional
    //    $mail->addReplyTo('*****@*****.**', 'Information');
    //    $mail->addCC('*****@*****.**');
    //    $mail->addBCC('*****@*****.**');
    //    $mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
    //    $mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
    //    $mail->isHTML(true);                                  // Set email format to HTML
    $mail->Subject = $asunto;
    $mail->Body = $mensaje;
    $mail->AltBody = $mensaje;
    if (!$mail->send()) {
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
    } else {
        echo 'Message has been sent';
    }
    //    // message lines should not exceed 70 characters (PHP rule), so wrap it
    //    $mensaje = wordwrap("Mensaje de ". $nombre . "\n Cuerpo del mensaje: " . $mensaje, 100);
    //    // send mail
    //    mail("*****@*****.**", $asunto, $mensaje, "From: $email\n");
    //    mail("*****@*****.**", $asunto, $mensaje, "From: $email\n");
    //    mail("*****@*****.**", $asunto, $mensaje, "From: $email\n");
    //    echo ($email . $nombre . $mensaje . $asunto);
}
Example #19
0
 public function send($emails, $template, $subject = 'Уведомление', $filepath = null)
 {
     $mail = new \PHPMailer();
     $portal = 'mediafirst.ru';
     $mail->isSMTP();
     //        $mail->SMTPDebug = 2;
     $mail->isHTML(true);
     $mail->CharSet = 'UTF-8';
     $mail->FromName = $portal;
     $mail->Subject = $subject;
     if ($filepath != null) {
         $mail->addAttachment($filepath, 'mediaplan.xls');
     }
     # prod - оптравка через Exim, dev/test - отправка через Gmail
     if ($this->container->getParameter('kernel.environment') == 'prod') {
         $mail->Host = '127.0.0.1';
         $mail->From = '*****@*****.**';
     } else {
         $mail->Host = 'smtp.gmail.com';
         $mail->From = '*****@*****.**';
         $mail->SMTPSecure = 'ssl';
         $mail->Port = 465;
         $mail->SMTPAuth = true;
         $mail->Username = '******';
         $mail->Password = '******';
     }
     # устанавливаем содержимое письма
     $templateParams = array('portal' => $portal);
     if (is_string($template)) {
         $templateName = $template;
     } else {
         $templateName = $template[0];
         $templateParams = array_merge($templateParams, $template[1]);
     }
     if ($templateParams == null) {
         $templateParams = array();
     }
     $mail->Body = $this->templating->render($templateName, $templateParams);
     # устанавливаем получателя(ей) письма
     if (is_string($emails)) {
         $mail->addAddress($emails);
     } else {
         foreach ($emails as $email) {
             $mail->addAddress($email);
         }
     }
     $mail->send();
 }
Example #20
0
function send_mail($msg_content, $s_email, $s_name)
{
    require '/home/paulme9/public_html/includes/PHPMailer/PHPMailerAutoload.php';
    $mail = new PHPMailer();
    $mail->isSMTP();
    $mail->Host = 'secure150.inmotionhosting.com';
    $mail->SMTPAuth = true;
    $mail->Username = '******';
    $mail->Password = '******';
    $mail->SMTPSecure = "ssl";
    $mail->Port = 465;
    $mail->SMTPDebug = 0;
    //0=none, 1=commands, 2=commands+data
    $mail->Debugoutput = 'html';
    $mail->From = '*****@*****.**';
    $mail->FromName = $s_name;
    $mail->Sender = $s_email;
    $mail->ReturnPath = '*****@*****.**';
    $mail->addAddress($s_email, $s_name);
    $mail->WordWrap = 60;
    $mail->Subject = 'Registration for paul-merideth.com';
    $mail->Body = $msg_content;
    if (!$mail->send()) {
        return FALSE;
    } else {
        return TRUE;
    }
}
Example #21
0
    public function comment_mail_notification()
    {
        $mail = new PHPMailer();
        $mail->isSMTP();
        $mail->Host = SMTP_HOST;
        $mail->SMTPAuth = SMTP_AUTH;
        $mail->Username = SMTP_USER;
        $mail->Password = SMTP_PASS;
        $mail->SMTPSecure = SMTP_SECURE;
        $mail->Port = SMTP_PORT;
        $mail->From = SMTP_FROM;
        $mail->FromName = SMTP_FROM_NAME;
        $mail->addReplyTo(SMTP_REPLY_TO, SMTP_REPLY_TO_NAME);
        $mail->addAddress(SMTP_TO, SMTP_TO_NAME);
        $mail->isHTML(SMTP_ISHTML);
        $mail->Subject = SMTP_SUBJECT . strftime("%T", time());
        $created = datetime_to_text($this->created);
        $mail_body = nl2br($this->body);
        $photo = Photograph::find_by_id($_GET['id']);
        $mail->Body = <<<EMAILBODY

A new comment has been received in the Photo Gallery.<br>
<br>
Photograph: {$photo->filename}<br>
<br>
On {$created}, {$this->author} wrote:<br>
<br>
{$mail_body}<br>

EMAILBODY;
        $result = $mail->send();
        return $result;
    }
function sendMail($password, $emailid, $firstname)
{
    $mail = new PHPMailer();
    //Enable SMTP debugging.
    //$mail->SMTPDebug = 3;
    //Set PHPMailer to use SMTP.
    //$mail->isSMTP();
    //Set SMTP host name
    $mail->Host = "mail.goodcreed.in";
    //Set this to true if SMTP host requires authentication to send email
    $mail->SMTPAuth = true;
    //Provide username and password
    $mail->Username = "******";
    $mail->Password = "******";
    //If SMTP requires TLS encryption then set it
    //Set TCP port to connect to
    $mail->Port = 25;
    $mail->From = "*****@*****.**";
    $mail->FromName = "Admin";
    $mail->addAddress($emailid);
    $mail->isHTML(true);
    $mail->Subject = "Gate Password Reset";
    $mail->Body = "<html><head></head><body>\n\t\t\t\t<div style='border:1px solid;border-color:purple;margin:10px;padding:10px'><font color='black'>\n\t\t\t\t<b><em>\n\t\t\t\tHi&nbsp;" . $firstname . ",<br><br>\n\t\t\t\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please click on the below link to reset your password.<br><br>\n\t\t\t\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http://gate2016.goodcreed.in/resetpassword.php?p=" . $password . "<br><br>\n\t\t\t\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If you are not the recipient of this mail, please ignore it.\n\t\t\t\t<br><br>\n\t\t\t\tThanks and Regards,<br>\n\t\t\t\tSaradhi(Founder of GoodCreed).</b></em></font>\n\t\t\t\t</div>\n\t\t\t\t</body>\n\t\t\t\t</html>";
    if (!$mail->send()) {
        //  echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
        //echo "Message has been sent successfully";
    }
}
Example #23
0
function mailsend($subjects, $emailto, $body, $fName, $lName)
{
    $mail = new PHPMailer();
    $mail->Host = 'smtp.gmail.com';
    // Specify main and backup SMTP servers
    $mail->isSMTP();
    $mail->SMTPAuth = true;
    // Enable SMTP authentication
    $mail->Username = '******';
    // SMTP username
    $mail->Password = '******';
    // SMTP password
    $mail->SMTPSecure = 'ssl';
    // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 465;
    // TCP port to connect to
    $mail->From = "*****@*****.**";
    $mail->FromName = "Honliz";
    $mail->addAddress($emailto);
    //Recipient //Name is optional
    $mail->Subject = $subjects;
    $mail->AddEmbeddedImage("photo/honliz_logo1.png", "my-attach", "photo/honliz_logo1.png");
    $mail->Body = $body;
    $mail->addReplyTo('*****@*****.**', 'Honliz Admin');
    $mail->isHTML(true);
    if (!$mail->send()) {
        //  echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
    }
}
Example #24
0
 public function userActivation($name, $adresse, $link)
 {
     global $CONFIG;
     $mail = new PHPMailer();
     //$mail->SMTPDebug = 3;                               // Enable verbose debug output
     $mail->isSMTP();
     // Set mailer to use SMTP
     $mail->Host = $CONFIG["MailHost"];
     // Specify main and backup SMTP servers
     $mail->SMTPAuth = true;
     // Enable SMTP authentication
     $mail->Username = $CONFIG["MailUser"];
     // SMTP username
     $mail->Password = $CONFIG["MailPasswort"];
     // SMTP password
     $mail->SMTPSecure = 'tls';
     // Enable TLS encryption, `ssl` also accepted
     $mail->Port = 587;
     // TCP port to connect to
     $mail->setFrom($CONFIG["MailAdresse"], $CONFIG["MailName"]);
     $mail->addAddress($adresse, $name);
     // Add a recipient
     $mail->isHTML(true);
     // Set email format to HTML
     $mail->Subject = 'TerminGrul Benutzer Bestaetigung';
     $mail->Body = 'Hier der Link zum Verifizieren deiner Mailadresse:<br><a href="' . $link . '">TerminGrul Verifizierung</a>';
     $mail->AltBody = 'Hier der Link zum Verifizieren deiner Mailadresse: ' . $link;
     $mail->send();
 }
Example #25
0
 public function SendEmail($account, $type)
 {
     $email = new \PHPMailer();
     $email->isSMTP();
     //        $email->Timeout       =   120;
     //$email->SMTPDebug = 2;
     //$email->Debugoutput = 'html';
     $email->Host = "smtp.gmail.com";
     $email->Port = 587;
     $email->SMTPSecure = "tls";
     $email->SMTPAuth = true;
     $email->Username = "******";
     $email->Password = "******";
     $email->setFrom("*****@*****.**", "Retos");
     $email->addReplyTo("*****@*****.**", "Retos");
     $email->addAddress("{$account}");
     $email->isHTML(true);
     $email->Subject = "Retos | Chontal Developers";
     $file = dirname(__DIR__) . "/views/email/index.html";
     $email->msgHTML(file_get_contents($file));
     if ($type == 1) {
         $email->AltBody = "Gracias por contactarnos en breve nos comunicaremos con usted. Les agradece El equipo Retos.";
     } else {
         if ($type == 2) {
             $email->AltBody = "Gracias por suscribirse a nuestro sito http://www.retos.co";
         }
     }
     if (!$email->send()) {
         //echo 'Message could not be sent.';
         //echo 'Mailer Error: ' . $email->ErrorInfo;
     } else {
         return true;
     }
 }
Example #26
0
function MailGin($correo, $nom, $msj)
{
    //Template Admin
    $templateAdmin = file_get_contents('MailAdminForm.html');
    $templateAdmin = str_replace('%nombre%', $nom, $templateAdmin);
    $templateAdmin = str_replace('%email%', $correo, $templateAdmin);
    $templateAdmin = str_replace('%mensaje%', $msj, $templateAdmin);
    $templateAdmin = str_replace('\\r\\n', '<br>', $templateAdmin);
    //Envia Mail
    $mail = new PHPMailer();
    $mail->Host = gethostbyname('smtp.gmail.com');
    //$mail->SMTPDebug = 3;
    $mail->isSMTP();
    $mail->Host = 'smtp.gmail.com';
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = "tls";
    $mail->Username = '******';
    $mail->Password = '******';
    $mail->Port = 587;
    $mail->setFrom('*****@*****.**', 'Gin Gin');
    $mail->addAddress('jcisneros@iegroup.mx ', 'Cisneros');
    $mail->addAddress('*****@*****.**', 'Iegroup');
    //$mail->addAddress('*****@*****.**','Developer');
    $mail->isHTML(true);
    $mail->CharSet = 'UTF-8';
    $mail->Subject = 'Has recibido un nuevo mensaje desde gin-gin.mx';
    $mail->Body = $templateAdmin;
    $mail->send();
    /*   if(!$mail->send()) {
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
    } else {
        echo 'Message has been sent' ;
            }
            */
    //Template Usuario
    $templateUser = file_get_contents('MailUserForm.html');
    $templateUser = str_replace('%nombre%', $nom, $templateUser);
    $templateUser = str_replace('\\r\\n', '<br>', $templateUser);
    //Envia Mail
    $mail = new PHPMailer();
    $mail->Host = gethostbyname('smtp.gmail.com');
    //$mail->SMTPDebug = 3;
    $mail->isSMTP();
    $mail->Host = 'smtp.gmail.com';
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = "tls";
    $mail->Username = '******';
    $mail->Password = '******';
    $mail->Port = 587;
    $mail->setFrom('*****@*****.**', 'Gin Gin');
    //$mail->addAddress('jcisneros@iegroup.mx ','Cisneros');
    //$mail->addAddress('*****@*****.**','Iegroup');
    $mail->addAddress($correo);
    $mail->isHTML(true);
    $mail->CharSet = 'UTF-8';
    $mail->Subject = 'Gracias por contactarnos a gin-gin.mx';
    $mail->Body = $templateUser;
    $mail->send();
}
Example #27
0
 public function sendMessage($from, $to, $subject, $body)
 {
     $config = $this->get('config')->data['services']['mailer'];
     $mail = new PHPMailer();
     // Configure SMTP
     ob_start();
     if ($config['smtp']) {
         $mail->SMTPDebug = 3;
         $mail->isSMTP();
         $mail->Timeout = 15;
         $mail->SMTPAuth = true;
         $mail->SMTPSecure = $config['smtpSecure'];
         $mail->Host = $config['smtpHost'];
         $mail->Port = $config['smtpPort'];
         $mail->Username = $config['smtpUser'];
         $mail->Password = $config['smtpPass'];
     }
     // Prepare the message
     $mail->setFrom($config['smtpUser']);
     $mail->addAddress($to);
     $mail->addReplyTo($from);
     $mail->isHTML(true);
     $mail->CharSet = 'UTF-8';
     $mail->Subject = $subject;
     $mail->Body = $body;
     $mail->AltBody = $body;
     // Send
     $success = $mail->send();
     $debugInfo = ob_get_contents();
     ob_end_clean();
     if (!$success) {
         $this->get('logger')->error($mail->ErrorInfo . "\nDebug information:\n\n" . $debugInfo);
     }
     return $success;
 }
Example #28
0
function autoMail($to, $subject, $messsageHTML, $messageText)
{
    require_once 'PHPMailer-master/PHPMailerAutoload.php';
    $mail = new PHPMailer();
    $mail->isSMTP();
    // Set mailer to use SMTP
    $mail->Host = 'smtp.googlemail.com';
    // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;
    // Enable SMTP authentication
    $mail->Username = '******';
    // SMTP username
    $mail->Password = '******';
    // SMTP password
    $mail->SMTPSecure = 'tls';
    $mail->Port = 587;
    // TCP port to connect to
    $mail->setFrom('*****@*****.**', 'Yelp Website admin : password lost');
    $mail->addAddress($to);
    //$mail->addBCC('*****@*****.**');
    $mail->isHTML(true);
    // Set email format to HTML
    $mail->Subject = $subject;
    $mail->Body = $messsageHTML;
    $mail->AltBody = $messageText;
    return $mail->send();
}
Example #29
0
 public function configureMailer()
 {
     $mail = new \PHPMailer();
     // $mail->SMTPDebug = 3;                               // Enable verbose debug output
     $mail->isSMTP();
     // Set mailer to use SMTP
     $mail->Host = getenv('EMAIL_SMTP');
     // Specify main and backup SMTP servers
     $mail->SMTPAuth = true;
     // Enable SMTP authentication
     $mail->Username = getenv('EMAIL_FROM');
     // SMTP username
     $mail->Password = getenv('EMAIL_FROM_PASSWORD');
     // SMTP password
     $mail->SMTPSecure = getenv('EMAIL_SMTP_SECURITY');
     // Enable TLS encryption, `ssl` also accepted
     $mail->Port = getenv('EMAIL_SMTP_PORT');
     // TCP port to connect to
     //From myself to myself (alter reply address)
     $mail->setFrom(getenv('EMAIL_FROM'), getenv('EMAIL_FROM_NAME'));
     $mail->addAddress(getenv('EMAIL_TO'), getenv('EMAIL_TO_NAME'));
     $mail->isHTML(true);
     // Set email format to HTML
     return $mail;
 }
 public function restaurarcuenta()
 {
     View::template('sbadmin');
     if (Input::hasPost('correo')) {
         $Usuario = new Usuario();
         $direccion = $_POST['correo']['email'];
         if ("SELECT count(*) FROM usuario WHERE email = '{$direccion}'" == 1) {
             $mail = new PHPMailer();
             $mail->isSMTP();
             //$mail­>SMTPDebug = 2;
             $mail->SMTPAuth = true;
             $mail->SMTPSecure = "ssl";
             $mail->Host = "smtp.gmail.com";
             $mail->Port = 465;
             $mail->Username = "******";
             $mail->Password = "******";
             $mail->setFrom('*****@*****.**', 'Gestión Documental');
             //$mail­>AddReplyTo("*****@*****.**", "Steven Ruiz");
             $mail->Subject = "asunto";
             $mail->msgHTML("mensaje");
             //$address = "*****@*****.**";
             $mail->addAddress($_POST['correo']['email'], "...");
             if (!$mail->send()) {
                 echo "Error al enviar: " . $mail->ErrorInfo;
             }
             Input::delete();
         } else {
             print_r("No hay cuenta asociada al correo digitado");
         }
     }
 }