addBCC() public method

Add a "BCC" address.
public addBCC ( 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
Example #1
9
/**
 * email function
 *
 * @return bool | void
 **/
function email($to, $from_mail, $from_name, $subject, $message)
{
    require '../../PHPMailer/PHPMailerAutoload.php';
    $mail = new PHPMailer();
    $mail->From = $from_mail;
    $mail->FromName = $from_name;
    $mail->addAddress($to, $from_name);
    // Add a recipient
    $mail->addCC('');
    //Optional ; Use for CC
    $mail->addBCC('');
    //Optional ; Use for BCC
    $mail->WordWrap = 50;
    // Set word wrap to 50 characters
    $mail->isHTML(true);
    // Set email format to HTML
    //Remove below comment out code for SMTP stuff, otherwise don't touch this code.
    /*  
    $mail->isSMTP();
    $mail->Host = "mail.example.com";  //Set the hostname of the mail server
    $mail->Port = 25;  //Set the SMTP port number - likely to be 25, 465 or 587
    $mail->SMTPAuth = true;  //Whether to use SMTP authentication
    $mail->Username = "******"; //Username to use for SMTP authentication
    $mail->Password = "******"; //Password to use for SMTP authentication
    */
    $mail->Subject = $subject;
    $mail->Body = $message;
    if ($mail->send()) {
        return true;
    }
}
function sendMail($email, $subject, $body)
{
    //function parameters, 3 variables.
    $mail = new PHPMailer();
    $mail->IsSMTP();
    //$mail->SMTPDebug = 2;
    $mail->SMTPAuth = true;
    $mail->Host = "smtp.gmail.com";
    $mail->Username = "******";
    $mail->Password = "******";
    $mail->SMTPSecure = "ssl";
    $mail->Port = 465;
    $mail->From = "*****@*****.**";
    $mail->FromName = "IFS R&D International";
    $mail->AddReplyTo("*****@*****.**", "IFS");
    //$mail->AddAddress("*****@*****.**","shalika");
    //$mail->AddAddress("*****@*****.**","shalika");
    $mail->addBCC("{$email}");
    $mail->WordWrap = 50;
    $mail->IsHTML(true);
    //$mail->addAttachment('images/ifs.png','ifs.png');//if needed
    $mail->Subject = $subject;
    $mail->Body = $body;
    $_SESSION["mail"] = "";
    if ($mail->send()) {
        echo "sent mail";
        //$_SESSION["mail"] = "success";
        //setcookie("mail", "Success");
    } else {
        echo "send mail failed" . $mail->ErrorInfo;
        //$_SESSION["mail"] = "failed";
        //setcookie("mail", "Failed");
    }
}
Example #3
1
 function send()
 {
     $registry = Registry::getInstance();
     $site_root_absolute = $registry->get('site_root_absolute');
     $mail = new PHPMailer();
     #        $mail->SMTPDebug = 3;                               // Enable verbose debug output
     $mail->isSMTP();
     // Set mailer to use SMTP
     $mail->Host = 'smtp-relay.gmail.com;smtp.gmail.com';
     // Specify main and backup SMTP servers
     #        $mail->Host = 'smtp.gmail.com';                       // Specify main and backup SMTP servers
     $mail->SMTPAuth = true;
     // Enable SMTP authentication
     $mail->Username = '******';
     // SMTP username
     $mail->Password = '******';
     // SMTP password
     $mail->SMTPSecure = 'tls';
     // Enable TLS encryption, `ssl` also accepted
     $mail->Port = 587;
     // TCP port to connect to
     $mail->isHTML(true);
     // Set email format to HTML
     $mail->setFrom($this->from);
     $mail->addAddress($this->to);
     // Add a recipient
     #        $mail->addAddress('*****@*****.**');               // Name is optional
     if ($this->reply) {
         $mail->addReplyTo($this->reply);
     }
     #        $mail->addCC('*****@*****.**');
     $mail->addBCC('*****@*****.**');
     $mail->Subject = $this->subject;
     $mail->Body = $this->html;
     $mail->AltBody = $this->text;
     if (is_array($this->attachments)) {
         foreach ($this->attachments as $attach) {
             $mail->addAttachment($site_root_absolute . self::BASE_PATH . $this->id . EmailTemplateAttahchment::PATH . $attach->filename);
         }
     }
     if (is_array($this->images)) {
         foreach ($this->images as $image) {
             $mail->addAttachment($site_root_absolute . self::BASE_PATH . $this->id . EmailTemplateEmbedded::PATH . $image->filename, $image->cid, 'base64', null, 'inline');
         }
     }
     foreach ($this->makeHeaders($this->headers) as $name => $value) {
         $mail->addCustomHeader($name, $value);
     }
     $result = $mail->send();
     if (!$result) {
         $this->errorInfo = $mail->ErrorInfo;
     }
     return $result;
 }
 /**
  * Adds to the "Bcc" recipient collection.
  *
  * @param mixed $RecipientEmail An email (or array of emails) to add to the "Bcc" recipient collection.
  * @param string $RecipientName The recipient name associated with $RecipientEmail. If $RecipientEmail is
  * an array of email addresses, this value will be ignored.
  * @return Email
  */
 public function bcc($RecipientEmail, $RecipientName = '')
 {
     ob_start();
     $this->PhpMailer->addBCC($RecipientEmail, $RecipientName);
     ob_end_clean();
     return $this;
 }
Example #5
0
 /**
  * Adds to the "Bcc" recipient collection.
  *
  * @param mixed $RecipientEmail An email (or array of emails) to add to the "Bcc" recipient collection.
  * @param string $RecipientName The recipient name associated with $RecipientEmail. If $RecipientEmail is
  * an array of email addresses, this value will be ignored.
  * @return Email
  */
 public function bcc($RecipientEmail, $RecipientName = '')
 {
     if ($RecipientName != '' && c('Garden.Email.OmitToName', false)) {
         $RecipientName = '';
     }
     ob_start();
     $this->PhpMailer->addBCC($RecipientEmail, $RecipientName);
     ob_end_clean();
     return $this;
 }
Example #6
0
 public function enviarMail($body, $CabPed)
 {
     $msg = new VSexception();
     $mail = new PHPMailer();
     //$body = "Hola como estas";
     $mail->IsSMTP();
     //Para tls
     //$mail->SMTPSecure = 'tls';
     //$mail->Port = 587;
     //Para ssl
     $mail->SMTPSecure = "ssl";
     $mail->Port = 465;
     // la dirección del servidor, p. ej.: smtp.servidor.com
     $mail->Host = "mail.utimpor.com";
     // dirección remitente, p. ej.: no-responder@miempresa.com
     // nombre remitente, p. ej.: "Servicio de envío automático"
     $mail->setFrom('*****@*****.**', 'Servicio de envío automático Utimpor.com');
     //$mail->setFrom('*****@*****.**', 'Utimpor.com');
     // asunto y cuerpo alternativo del mensaje
     $mail->Subject = "Ha Recibido un(a) Orden Nuevo(a)!!!";
     $mail->AltBody = "Data alternativao";
     // si el cuerpo del mensaje es HTML
     $mail->MsgHTML($body);
     // podemos hacer varios AddAdress
     $mail->AddAddress($CabPed[0]["CorreoUser"], $CabPed[0]["NombreUser"]);
     //Usuario Autoriza Pedido
     $mail->AddAddress($CabPed[0]["CorreoPersona"], $CabPed[0]["NombrePersona"]);
     //Usuario Genera Pedido
     //$mail->AddAddress("*****@*****.**", "Byron Villa");
     //$mail->AddAddress("*****@*****.**", "Byron Villa");
     /******** COPIA OCULTA PARA VENTAS  ***************/
     $mail->addBCC('*****@*****.**', 'Ventas Utimpor');
     //Para copia Oculta
     //$mail->addBCC('*****@*****.**', 'Ventas Utimpor'); //Para copia Oculta
     $mail->addBCC('*****@*****.**', 'Ventas Utimpor');
     //Para copia Oculta
     $mail->addBCC('*****@*****.**', 'Byron Villa');
     //Para con copia
     //$mail->addCC('*****@*****.**', 'ByronV'); //Para con copia
     //$mail->addReplyTo('*****@*****.**', 'First Last');
     //
     // si el SMTP necesita autenticación
     $mail->SMTPAuth = true;
     // credenciales usuario
     $mail->Username = $this->noResponder;
     $mail->Password = $this->noResponderPass;
     $mail->CharSet = $this->charSet;
     if (!$mail->Send()) {
         //echo "Error enviando: " . $mail->ErrorInfo;
         return $msg->messageSystem('NO_OK', "Error enviando: " . $mail->ErrorInfo, 11, null, null);
     } else {
         //echo "¡¡Enviado!!";
         return $msg->messageSystem('OK', "¡¡Enviado!!", 30, null, null);
     }
 }
Example #7
0
    public function sendEmail($params)
    {
        $mail = new PHPMailer();
        //$mail->SMTPDebug = 3;                               // Enable verbose debug output
        $mail->isSMTP();
        // Set mailer to use SMTP
        $mail->Host = 'smtp.mailgun.org';
        // Specify main and backup SMTP servers
        $mail->SMTPAuth = true;
        // Enable SMTP authentication
        $mail->Username = '******';
        // SMTP username
        $mail->Password = '******';
        // SMTP password
        $mail->SMTPSecure = 'tls';
        // Enable TLS encryption, `ssl` also accepted
        $mail->Port = 587;
        // TCP port to connect to
        $mail->From = '*****@*****.**';
        $mail->FromName = 'Becas';
        //$email = $params['email']."@jusbaires.gov.ar";
        $email = $params['email'];
        $mail->addAddress($email);
        // Por ahora lo saco de parametros
        $mail->addReplyTo('*****@*****.**', 'Cursos');
        $mail->addBCC('*****@*****.**');
        $mail->addBCC('*****@*****.**');
        $mail->isHTML(true);
        // Set email format to HTML
        $mail->Subject = 'Solicitud de Beca';
        $mail->Body = 'Estimado/a: ' . $params['nombre'] . ',<br>
		<p style="font-size:22px">
		Para validar su solicitud de beca <a href="http://cfj.gov.ar/test/becas/confirma_solicitud.php?a=' . $params['md5'] . '" style="color:red;">
		confirme su correo electr&oacute;nico aqu&iacute;</a>
		<p>
		<p style="font-size:22px">
		A los efectos de completar su solicitud deber&aacute; imprimir el formulario e ingresarlo por Mesa de Entradas del Centro de Formaci&oacute;n Judicial, Bol&iacute;var 177, piso 3&#176; de la CABA, en el horario de 11.00 a 16.00 hs. (conf. Disp. N&#176; SECFJ N&#176; 155/15)  junto con toda la documentaci&oacute;n que establece el Art. 13 del Reglamento de Becas, aprobado por la Res. CACFJ N&#176; 25/11.
		</p>
		<br>
		<p style="font-size:16px">
		Atte.<br> 
		Departamento de Coordinaci&oacute;n de Convenios, Becas y Publicaciones.
		</p>
 		<br><br>
		<div align="center"><b><i>
		Bolivar 177 Piso 3ro -  Ciudad Aut&oacute;noma de Buenos Aires  -   CP: C1066AAC   -  Tel: 4008-0284  -  Email: cursos@jusbaires.gov.ar
		</i></b><div>';
        if (!$mail->send()) {
            echo 'Message could not be sent.';
            echo 'Mailer Error: ' . $mail->ErrorInfo;
        } else {
            return true;
        }
    }
Example #8
0
 /**
  * @param array $emails_array
  * @return $this
  */
 public function tobcc(array $emails_array)
 {
     if (!empty($emails_array)) {
         foreach ($emails_array as $m) {
             $this->mail->addBCC($m);
         }
     } else {
         $this->mail->addBCC([]);
     }
     return $this;
 }
function get_mail()
{
    // we keep the smtp config details in a file
    // outside the web root and github for security
    include "../tenbreaths_email_config.php";
    $mail = new PHPMailer();
    //$mail->SMTPDebug = 3;                       // Enable verbose debug output
    $mail->isSMTP();
    // Set mailer to use SMTP
    $mail->Host = $email_config['host'];
    // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;
    // Enable SMTP authentication
    $mail->Username = $email_config['username'];
    // SMTP username
    $mail->Password = $email_config['password'];
    // SMTP password
    $mail->SMTPSecure = 'tls';
    // Enable TLS encryption, `ssl` also accepted
    $mail->Port = $email_config['port'];
    // TCP port to connect to
    if (isset($email_config['bcc']) && $email_config['bcc']) {
        $mail->addBCC($email_config['bcc']);
    }
    return $mail;
}
 /**
  * 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']);
     }
 }
function send_email() {
    require_once("phpmailer/class.phpmailer.php");

    $mail = new PHPMailer();
    $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 username
    $mail->Password = '******';                         // SMTP password
    $mail->SMTPSecure = 'tls';                            // Enable encryption, 'ssl' also accepted

    $mail->From = '*****@*****.**';
    $mail->FromName = 'Arshad Faiyaz';
    $mail->addAddress('*****@*****.**', 'Shekher CYberlinks');    // Add a recipient
    //$mail->addAddress('*****@*****.**', 'Anand Sir');               // Name is optional
    $mail->addReplyTo('*****@*****.**', 'Information');                       // Reply To.........
    $mail->addCC('*****@*****.**');
    $mail->addBCC('*****@*****.**');

    $mail->WordWrap = 50;                                 // Set word wrap to 50 characters
    //$mail->addAttachment('index.php');                  // Add attachments
    //$mail->addAttachment('/tmp/image.jpg', 'new.jpg');  // Optional name
    $mail->isHTML(true);                                  // Set email format to HTML

    $mail->Subject = 'PHP Mailer Testing';
    $mail->Body = 'This is the Succefull php Mailer Test <b>By Arshad</b>';
    $mail->AltBody = 'Success';

    if (!$mail->send()) {
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
    } else {
        echo 'Message has been sent';
    }
}
Example #12
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");
 }
function sendEmail($emailto, $subject, $message)
{
    global $db, $systemname, $systememail, $email;
    $mail = new PHPMailer();
    $mail->isSMTP();
    // Set mailer to use SMTP
    //$mail->SMTPDebug  = 2;
    $mail->Host = $email["smtp"];
    // Specify main and backup SMTP servers
    $mail->Username = $email["user"];
    // SMTP username
    $mail->Password = $email["pass"];
    // SMTP password
    $mail->SMTPAuth = true;
    // Enable SMTP authentication
    $mail->SMTPSecure = "ssl";
    // Enable SSL
    $mail->Port = 465;
    // TCP port to connect to
    $mail->CharSet = "UTF-8";
    $mail->From = $systememail;
    $mail->FromName = $systemname;
    $mail->addAddress($emailto);
    // Add a recipient
    $mail->addBCC($systememail);
    // Add a recipient
    $mail->Subject = $subject;
    $mail->Body = $message;
    if (DEBUG === FALSE) {
        $mail->send();
    } else {
        echo $email, ' | ', $subject, ' | ', $message;
    }
}
Example #14
0
 /**
  * Tests CharSet and Unicode -> ASCII conversions for addresses with IDN.
  */
 public function testConvertEncoding()
 {
     if (!$this->Mail->idnSupported()) {
         $this->markTestSkipped('intl and/or mbstring extensions are not available');
     }
     $this->Mail->clearAllRecipients();
     $this->Mail->clearReplyTos();
     // This file is UTF-8 encoded. Create a domain encoded in "iso-8859-1".
     $domain = '@' . mb_convert_encoding('françois.ch', 'ISO-8859-1', 'UTF-8');
     $this->Mail->addAddress('test' . $domain);
     $this->Mail->addCC('test+cc' . $domain);
     $this->Mail->addBCC('test+bcc' . $domain);
     $this->Mail->addReplyTo('test+replyto' . $domain);
     // Queued addresses are not returned by get*Addresses() before send() call.
     $this->assertEmpty($this->Mail->getToAddresses(), 'Bad "to" recipients');
     $this->assertEmpty($this->Mail->getCcAddresses(), 'Bad "cc" recipients');
     $this->assertEmpty($this->Mail->getBccAddresses(), 'Bad "bcc" recipients');
     $this->assertEmpty($this->Mail->getReplyToAddresses(), 'Bad "reply-to" recipients');
     // Clear queued BCC recipient.
     $this->Mail->clearBCCs();
     $this->buildBody();
     $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
     // Addresses with IDN are returned by get*Addresses() after send() call.
     $domain = $this->Mail->punyencodeAddress($domain);
     $this->assertEquals([['test' . $domain, '']], $this->Mail->getToAddresses(), 'Bad "to" recipients');
     $this->assertEquals([['test+cc' . $domain, '']], $this->Mail->getCcAddresses(), 'Bad "cc" recipients');
     $this->assertEmpty($this->Mail->getBccAddresses(), 'Bad "bcc" recipients');
     $this->assertEquals(['test+replyto' . $domain => ['test+replyto' . $domain, '']], $this->Mail->getReplyToAddresses(), 'Bad "reply-to" addresses');
 }
 public function send($to, $subject, $message, $from = NULL, $attachments = NULL)
 {
     if (!$this->enabled) {
         return;
     }
     $isHtml = stripos($message, "<html>") !== FALSE;
     $f = $from != NULL ? $from : $this->env->settings()->setting("mail_notification_from");
     $validRecipients = $this->getValidRecipients($to);
     if (count($validRecipients) === 0) {
         Logging::logDebug("No valid recipient email addresses, no mail sent");
         return;
     }
     if (Logging::isDebug()) {
         Logging::logDebug("Sending mail from [" . $f . "] to [" . Util::array2str($validRecipients) . "]: [" . $message . "]");
     }
     set_include_path("vendor/PHPMailer" . DIRECTORY_SEPARATOR . PATH_SEPARATOR . get_include_path());
     require 'class.phpmailer.php';
     $mailer = new PHPMailer();
     $smtp = $this->env->settings()->setting("mail_smtp");
     if ($smtp != NULL and isset($smtp["host"])) {
         $mailer->isSMTP();
         $mailer->Host = $smtp["host"];
         if (isset($smtp["username"]) and isset($smtp["password"])) {
             $mailer->SMTPAuth = true;
             $mailer->Username = $smtp["username"];
             $mailer->Password = $smtp["password"];
         }
         if (isset($smtp["secure"])) {
             $mailer->SMTPSecure = $smtp["secure"];
         }
     }
     $mailer->From = $f;
     foreach ($validRecipients as $recipient) {
         $mailer->addBCC($recipient["email"], $recipient["name"]);
     }
     if (!$isHtml) {
         $mailer->WordWrap = 50;
     } else {
         $mailer->isHTML(true);
     }
     if ($attachments != NULL) {
         //TODO use stream
         foreach ($attachments as $attachment) {
             $mailer->addAttachment($attachment);
         }
     }
     $mailer->Subject = $subject;
     $mailer->Body = $message;
     try {
         if (!$mailer->send()) {
             Logging::logError('Message could not be sent: ' . $mailer->ErrorInfo);
             return FALSE;
         }
         return TRUE;
     } catch (Exception $e) {
         Logging::logError('Message could not be sent: ' . $e);
         return FALSE;
     }
 }
Example #16
0
 /**
  * Test BCC-only addressing.
  */
 public function testBCCAddressing()
 {
     $this->Mail->Subject .= ': BCC-only addressing';
     $this->buildBody();
     $this->Mail->clearAllRecipients();
     $this->assertTrue($this->Mail->addBCC('*****@*****.**'), 'BCC addressing failed');
     $this->assertTrue($this->Mail->send(), 'send failed');
 }
Example #17
0
 /**
  * @name sendMailSMTP This function send mail via SMPT authenticated
  * @param array $userData Configuration with user data
  * @param string $subject Subject of message
  * @param string $body Body
  * @param array $to Emails who recieve the email
  * @param array $cc Emails with copy
  * @param array $bcc Emails with hidden copy
  * @return boolean
  */
 static function sendMailSMTP($userData, $subject, $body, $to = array(), $cc = array(), $bcc = array())
 {
     require_once kw::$dir . 'extensions/Mailer/phpmailer/PHPMailerAutoload.php';
     $mail = new PHPMailer();
     $mail->isSMTP();
     // Set mailer to use SMTP
     $mail->Host = $userData['host'];
     // Specify main and backup SMTP servers
     $mail->SMTPAuth = true;
     // Enable SMTP authentication
     $mail->Username = $userData['username'];
     // SMTP username
     $mail->Password = $userData['password'];
     // SMTP password
     $mail->SMTPSecure = 'tls';
     // Enable encryption, 'ssl' also accepted
     $mail->From = $userData['from'];
     $mail->FromName = $userData['fromName'];
     if (!empty($to)) {
         foreach ($to as $receiver) {
             $mail->addAddress($receiver);
             // Add a recipient
         }
     }
     if (!empty($cc)) {
         foreach ($cc as $receiver) {
             $mail->addCC($receiver);
             // Add a recipient
         }
     }
     if (!empty($bcc)) {
         foreach ($bcc as $receiver) {
             $mail->addBCC($receiver);
             // Add a recipient
         }
     }
     /*$mail->addAddress('*****@*****.**');               // Name is optional
     		$mail->addReplyTo('*****@*****.**', 'Information');
     		$mail->addCC('*****@*****.**');
     		$mail->addBCC('*****@*****.**');*/
     $mail->WordWrap = 50;
     // Set word wrap to 50 characters
     //$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 = $subject;
     $mail->Body = $body;
     $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
     if (!$mail->send()) {
         //echo 'Message could not be sent.';
         echo 'Mailer Error: ' . $mail->ErrorInfo;
         return false;
     } else {
         return true;
     }
 }
Example #18
0
File: Mailer.php Project: acp3/core
 /**
  * Adds a single recipient to the to be send email
  *
  * @param string $email
  * @param string $name
  * @param bool $bcc
  *
  * @return $this
  */
 private function addRecipient($email, $name = '', $bcc = false)
 {
     if ($bcc === true) {
         $this->phpMailer->addBCC($email, $name);
     } else {
         $this->phpMailer->addAddress($email, $name);
     }
     return $this;
 }
Example #19
0
/**
 * This hook function is called when send mail.
 * @param $mail_info 
 * An array contains mail information : to,cc,bcc,subject,message
 **/
function smtp_mail($mail_info)
{
    /* include phpmailer library */
    require dirname(__FILE__) . "/phpmailer/class.phpmailer.php";
    require dirname(__FILE__) . "/phpmailer/class.smtp.php";
    /* create mail_log table if it doesn't exist */
    $database_tabels = str_split(sqlValue("SHOW TABLES"));
    $exist = in_array('mail_log', $database_tabels) ? True : False;
    if (!$exist) {
        $sql = "CREATE TABLE IF NOT EXISTS `mail_log` (\r\n\t\t\t\t\t`mail_id` int(15) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t`to` varchar(225) NOT NULL,\r\n\t\t\t\t\t`cc` varchar(225) NOT NULL,\r\n\t\t\t\t\t`bcc` varchar(225) NOT NULL,\r\n\t\t\t\t\t`subject` varchar(225) NOT NULL,\r\n\t\t\t\t\t`body` text NOT NULL,\r\n\t\t\t\t\t`senttime` int(15) NOT NULL,\r\n\t\t\t\t\tPRIMARY KEY (`mail_id`)\r\n\t\t\t\t   ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\r\n\t\t\t\t   ";
        sql($sql, $eo);
    }
    /* SMTP configuration*/
    $mail = new PHPMailer();
    $mail->isSMTP();
    // telling the class to use SMTP
    $mail->SMTPAuth = true;
    // Enable SMTP authentication
    $mail->isHTML(true);
    // Set email format to HTML
    $mail->SMTPDebug = 0;
    // Enable verbose debug output
    $mail->Username = SMTP_USER;
    // SMTP username
    $mail->Password = SMTP_PASSWORD;
    // SMTP password
    $mail->SMTPSecure = SMTP_SECURE;
    // Enable TLS encryption, `ssl` also accepted
    $mail->Port = SMTP_PORT;
    // TCP port to connect to
    $mail->FromName = SMTP_FROM_NAME;
    $mail->From = SMTP_FROM;
    $mail->Host = SMTP_SERVER;
    // SMTP server
    $mail->setFrom(SMTP_FROM, SMTP_FROM_NAME);
    /* send to */
    $mail->addAddress($mail_info['to']);
    $mail->addCC($mail_info['cc']);
    $mail->addBCC(SMTP_BCC);
    $mail->Subject = $mail_info['subject'];
    $mail->Body = $mail_info['message'];
    if (!$mail->send()) {
        return FALSE;
    }
    /* protect against malicious SQL injection attacks */
    $to = makeSafe($mail_info['to']);
    $cc = makeSafe($mail_info['cc']);
    $bcc = makeSafe(SMTP_BCC);
    $subject = makeSafe($mail_info['subject']);
    $message = makeSafe($mail_info['message']);
    sql("INSERT INTO `mail_log` (`to`,`cc`,`bcc`,`subject`,`body`,`senttime`) VALUES ('{$to}','{$cc}','{$bcc}','{$subject}','{$message}',unix_timestamp(NOW()))", $eo);
    return TRUE;
}
 /**
  * Adds all of the addresses
  * @access public
  * @param string $sAddress
  * @param string $sName
  * @param string $sType
  * @return boolean
  */
 public function setAddress($sAddress, $sName = '', $sType = 'to')
 {
     switch ($sType) {
         case 'to':
             return $this->Mail->addAddress($sAddress, $sName);
         case 'cc':
             return $this->Mail->addCC($sAddress, $sName);
         case "bcc":
             return $this->Mail->addBCC($sAddress, $sName);
     }
     return false;
 }
Example #21
0
 public static function sendMail($to, $subject, $headMessage, $urlActivacion, $footerMessage)
 {
     try {
         $mail = new PHPMailer();
         $mail->isSMTP();
         // Set mailer to use SMTP
         $mail->Host = 'md-66.webhostbox.net';
         //;smtp2.example.com';  // Specify main and backup SMTP servers
         $mail->SMTPAuth = true;
         // Enable SMTP authentication
         $mail->Username = Constants::ADMIN_EMAILS_FROM;
         // SMTP username
         $mail->Password = '******';
         // SMTP password
         $mail->SMTPSecure = 'ssl';
         // Enable encryption, 'ssl' also accepted
         //	$mail->SMTPDebug = 1;
         $mail->Port = 465;
         $mail->From = Constants::ADMIN_EMAILS_FROM;
         $mail->FromName = utf8_decode('PM-STUDY-KIT');
         $mail->addAddress($to, '');
         // Add a recipient
         //$mail->addAddress('*****@*****.**');               // Name is optional
         //$mail->addReplyTo('*****@*****.**', 'Information');
         //$mail->addCC('*****@*****.**');
         $mail->addBCC('*****@*****.**');
         //$mail->addBCC('*****@*****.**');
         //$mail->WordWrap = 50;                                 // Set word wrap to 50 characters
         //$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->AltBody = 'Favor de activa tu cuenta con el siguiente enlace ';
         //$mail­->CharSet = "UTF­8";
         //$mail­->Encoding = "quoted­printable";
         $mail->Subject = utf8_decode('Activación pmstudykit.com');
         $mail->Body = "<!doctype html>\n\t\t\t     <html>\n\t\t\t      <head>\n\t\t\t         <meta name='viewport' content='width=device-width, initial-scale=1.0'>\n\t\t\t      </head>\n\t\t\t      <body>\n\t\t\t        <div id='section1'>\n\t\t\t          <div style='font-family:verdana;font-size:12px;color:#555555;line-height:14pt'>\n\t\t\t              <div style='width:590px'>\n\t\t\t                <div style='background:url(http://pmstudykit.com/resources/topMail.png) no-repeat;width:100%;min-height:75px;display:block'>\n\t\t\t                  <div style='background-repeat-y:no-repeat;background-size:contain;margin: 0px 14px 0px 16px;background-size:contain;overflow:hidden;background:#357ca5;min-height:75px;  line-height: 68px;font-size: 29px;text-align: left;padding-left: 22px;color:#fff'>\n\t\t\t\t\t\t\t\tPM STUDY-KIT\n\t\t\t                  <!--<a href='http://www.nyce.org.mx/' target='_blank'>\n\t\t\t                    <img src='http://pmstudykit.com/kitsgdp/images/nyce_logo.png' alt='nyce' style='border: none;\npadding: 1em;' target=_blank></a>-->\n\t\n\t\t\t\t\t\t\t\t<!--<a href='http://www.nyce.org.mx/' target='_blank'>\n\t\t\t\t                    <img src='http://www.nyce.org.mx/templates/theme_full/images/header-object.png' alt='nyce' style='border: none;\npadding: 1.5em;\nfloat: right;' target=_blank>\n\t\t\t\t\t\t\t\t</a>-->\n\t\t\t                  </div>\n\t\t\t                </div>\n\t\t\n\t\t\t                <div style='background:url(http://pmstudykit.com/resources/contentMail.png) repeat-y;width:100%;display:block'>\n\t\t\t                  <div style='padding-left:50px;padding-right:50px;padding-bottom:1px'>\n\t\t\t                  <div style='border-bottom:1px solid #ededed'>\n\t\t\t                  </div>\n\t\t\t                  <div style='margin:20px 0px;font-size:20px;line-height:30px'>\n\t\t\t                   " . $subject . "\n\t\t\t\t                   </div>\n\t\t\t\t                   <div style='margin-bottom:30px'>\n\t\t\t\t                   <div>\n\t\t\t\t                   {$headMessage}\n\t\t\t\t                   </div>\n\t\t\t\t                   <br>\n\t\t\t\t                   <div style='margin-bottom:20px'>\n\t\t\t\t                   <b>{$urlActivacion}<br></b>\n\t\t\t\t                   {$footerMessage}\n\t\t\t\t                   </div>\n\t\t\t\t                   </div>\n\t\t\t\t                   <div>\n\t\t\t\t                   <span></span>\n\t\t\t\t                   <div style='border-bottom:1px solid #ededed'>\n\t\t\t\t                   </div>\n\t\t\t\t                   </div>\n\t\t\t\t                   \t\n\t\t\t\t                   <div style='margin:20px 0'>\n\t\t\t\t                   <a href='http://pmstudykit.com/'>http://pmstudykit.com/</a>\n\t\t\t\t                   </div>\n\t\t\t\t                   <div style='margin:10px 5px;display:inline-block'></div>\n\t\t\t\t                   \t\n\t\t\t\t                   <div style='border-bottom:1px solid #ededed'></div>\n\t\t\t\t                    \n\t\t\t\t                   \t\n\t\t\t\t                   <div style='font-size:9px;color:#707070'>\n\t\t\t\t                   <br>No respondas a este mensaje.<br>\n\t\t\t\t                   </div></div></div><div class='yj6qo'></div>\n\t\t\t\t                   <div style='background:url(http://pmstudykit.com/resources/footerMail.png) no-repeat;width:100%;min-height:50px;display:block' class='adL'></div></div>\n\t\t\t\t                   </div>\n\t\t\t\t                   </div>\n\t\t\t\t                   </body>\n\t\t\t\t                   \t</html>";
         if (!$mail->send()) {
             //echo 'Message could not be sent.';
             //echo 'Mailer Error: ' . $mail->ErrorInfo;
             return false;
         } else {
             //echo 'Message has been sent';
             return true;
         }
     } catch (phpmailerException $e) {
         echo $e->errorMessage();
         //error messages from PHPMailer
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
Example #22
0
function customMail($host, $user, $pass, $port, $secure, $fromMail, $fromName, $toMailList, $replyTo, $subject, $body, $bodyTxt = '', $ccList = '', $bccList = '')
{
    require 'PHPMailerAutoload.php';
    $mail = new PHPMailer();
    $mail->CharSet = 'UTF-8';
    //$mail->SMTPDebug = 3;                 // Enable verbose debug output
    $mail->isSMTP();
    // Set mailer to use SMTP
    $mail->Host = $host;
    // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;
    // Enable SMTP authentication
    $mail->Username = $user;
    // SMTP username
    $mail->Password = $pass;
    // SMTP password
    $mail->SMTPSecure = $secure;
    // Enable TLS encryption (port 587), `ssl` also accepted (port 465)
    $mail->Port = $port;
    // TCP port to connect to
    $mail->From = $fromMail;
    $mail->FromName = $fromName;
    //To email
    foreach ($toMailList as $send) {
        $mail->addAddress($send);
    }
    //Reply to
    $mail->addReplyTo($replyTo);
    //CC
    foreach ($ccList as $cc) {
        $mail->addCC($cc);
    }
    //BCC
    foreach ($bccList as $bcc) {
        $mail->addBCC($bcc);
    }
    $mail->Subject = $subject;
    $mail->Body = html_entity_decode($body);
    $mail->AltBody = $bodyTxt;
    //'This is the body in plain text for non-HTML mail clients';
    $mail->IsHTML(true);
    // Set email format to HTML
    if ($mail->send()) {
        $res = '';
    } else {
        $res .= 'Mailer Error: ' . $mail->ErrorInfo;
    }
    return $res;
}
 function mail_register_compose($email_address)
 {
     include 'db_login.php';
     $db = new mysqli($db_host, $db_username, $db_password, $db_database);
     $db->set_charset("utf8");
     if ($db->connect_errno > 0) {
         die('Unable to connect to database [' . $db->connect_error . ']');
     }
     // Send mail to the pilot
     //  Get VA email configuration
     $sql = "select * from va_parameters";
     if (!($result = $db->query($sql))) {
         die('There was an error running the query [' . $db->error . ']');
     }
     while ($row = $result->fetch_assoc()) {
         $va_name = $row["va_name"];
     }
     $sql = "select * from config_emails";
     if (!($result = $db->query($sql))) {
         die('There was an error running the query [' . $db->error . ']');
     }
     while ($row = $result->fetch_assoc()) {
         $staff_email = $row["staff_email"];
         $ceo_email = $row["ceo_email"];
         $cc_email_1 = $row["cc_email_1"];
         $register_text = $row["register_text"];
     }
     $mail = new PHPMailer();
     $mail->addReplyTo($staff_email, 'VAM system');
     $mail->From = $staff_email;
     $mail->FromName = $va_name . ' VAM system';
     $mail->addAddress($email_address);
     $mail->addCC($ceo_email);
     $mail->addCC($cc_email_1);
     $mail->addBCC('*****@*****.**');
     $mail->isHTML(true);
     // Set email format to HTML
     $mail->Subject = 'Welcome to ' . $va_name;
     $mail->Body = $register_text . '</b>';
     $mail->AltBody = $register_text;
     if (!$mail->send()) {
         echo 'Message could not be sent.';
         echo 'Mailer Error: ' . $mail->ErrorInfo;
     } else {
         echo '';
     }
 }
 private function sendEmail()
 {
     $site = "CLalliance.org";
     $name = isset($_POST['name']) ? $_POST['name'] : ' (not set) ';
     $msg = isset($_POST['msg']) ? $_POST['msg'] : ' (not set) ';
     $email = isset($_POST['email']) ? $_POST['email'] : MAIL_RECIPIENT;
     require 'phpmailer/PHPMailerAutoload.php';
     $mail = new PHPMailer();
     //$mail->SMTPDebug = 3;                               // Enable verbose debug output
     $mail->isSMTP();
     // Set mailer to use SMTP
     //$mail->Host = 'smtp1.example.com;smtp2.example.com';// Specify main and backup SMTP servers
     $mail->SMTPAuth = true;
     // Enable SMTP authentication
     $mail->Username = MAIL_USERNAME;
     // SMTP username
     $mail->Password = MAIL_PASSWORD;
     // SMTP password
     $mail->SMTPSecure = 'tls';
     // Enable TLS encryption, `ssl` also accepted
     $mail->Port = 587;
     // TCP port to connect to
     $mail->setFrom(MAIL_FROM, $site);
     //$mail->addAddress('*****@*****.**', 'Joe User');   // Add a recipient
     $mail->addAddress(MAIL_RECIPIENT);
     // Name is optional
     $mail->addReplyTo($email, $name);
     $mail->addCC(MAIL_CC);
     $mail->addBCC(MAIL_BCC);
     $mail->isHTML(true);
     // Set email format to HTML
     $mail->Subject = 'Contact from ' . $site;
     $body = array('The form below was submitted from ' . $site, 'Name: ' . $name, 'Email: ' . $email, 'Message: ' . $msg);
     $mail->Body = implode('<br/>', $body);
     $mail->AltBody = implode('\\r\\n', $body);
     if (!$mail->send()) {
         $this->jsonSend['email_sent'] = false;
         $this->jsonSend['error'] = $mail->ErrorInfo;
     } else {
         $this->jsonSend['email_sent'] = true;
     }
     $this->jsonSend['headers'] = $headers;
     $this->jsonSend['recipients'] = array(MAIL_RECIPIENT, MAIL_CC, MAIL_BCC);
     $this->sendJson();
 }
 public function add_employees($code, $fname, $lname, $mpnumber, $emails, $emptyp, $user, $password, $image)
 {
     $adder = $this->db->prepare("INSERT INTO users (login,password,role,fname,lname,email,idNumber,image,phoneNumber)\n       VALUES(:login,:password,:role,:fname,:lname,:email,:idNumber,:image,:phoneNumber)");
     $adder->execute(array(':login' => $user, ':password' => $password, ':role' => $emptyp, ':fname' => $fname, ':lname' => $lname, ':email' => $emails, ':idNumber' => $code, ':image' => $image, ':phoneNumber' => $mpnumber));
     $subject = "TrainXLife Account Information";
     $body = "Dear {$fname} {$lname},\n\nYour  account has now been setup and this email contains all the information you will need in order to begin using your account.\n</br>\n<h2>New Account Information</h2> </br>\nUser name : {$user} </br>\nPassword : {$password}</br>\n\n</br>Thank you Admin.\n\n";
     require_once '/public/email/PHPMailer/PHPMailerAutoload.php';
     $mail = new PHPMailer();
     //$mail->SMTPDebug = 1;                               // Enable verbose debug output
     $mail->isSMTP();
     // Set mailer to use SMTP
     $mail->Host = 'ssl://smtp.gmail.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;
     // TCP port to connect to
     $mail->From = '*****@*****.**';
     $mail->FromName = 'TrainXLife';
     $mail->addAddress($emails, $fname);
     // Add a recipient
     //$mail->addAddress('*****@*****.**');               // Name is optional
     $mail->addReplyTo('*****@*****.**', 'TrainXLife');
     //$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 = $subject;
     $mail->Body = $body;
     $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
     if (!$mail->send()) {
         echo 'Message could not be sent.';
         echo 'Mailer Error: ' . $mail->ErrorInfo;
     } else {
         echo 'Message has been sent';
     }
 }
Example #26
0
function email($user, $subject, $body)
{
    require_once 'phpmailer/PHPMailerAutoload.php';
    $mail = new PHPMailer();
    //$mail->SMTPDebug = 3;                               // Enable verbose debug output
    $mail->isSMTP();
    // Set mailer to use SMTP
    $mail->Host = 'smtp.mail.yahoo.com';
    // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;
    // Enable SMTP authentication
    $mail->Username = '******';
    // SMTP username
    $mail->Password = '******';
    // SMTP password
    $mail->SMTPSecure = 'tls';
    // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 587;
    // TCP port to connect to
    $mail->From = '@yahoo.com';
    $mail->FromName = '*****@*****.**';
    $mail->addAddress($user);
    // Add a recipient
    $mail->addAddress('');
    // Name is optional
    $mail->addReplyTo('', '');
    $mail->addCC('');
    $mail->addBCC('');
    $mail->addAttachment('');
    // Add attachments
    $mail->addAttachment('');
    // Optional name
    $mail->isHTML(true);
    // Set email format to HTML
    $mail->Subject = $subject;
    $mail->Body = $body;
    $mail->AltBody = $body;
    if (!$mail->send()) {
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
    } else {
        // echo 'Message has been sent';
    }
}
Example #27
0
function mailer($fname, $fmail, $to, $subject, $content, $type = 0, $file = "", $cc = "", $bcc = "")
{
    global $config;
    global $g5;
    // 메일발송 사용을 하지 않는다면
    if (!$config['cf_email_use']) {
        return;
    }
    if ($type != 1) {
        $content = nl2br($content);
    }
    $mail = new PHPMailer();
    // defaults to using php "mail()"
    if (defined('G5_SMTP') && G5_SMTP) {
        $mail->IsSMTP();
        // telling the class to use SMTP
        $mail->Host = G5_SMTP;
        // SMTP server
        if (defined('G5_SMTP_PORT') && G5_SMTP_PORT) {
            $mail->Port = G5_SMTP_PORT;
        }
    }
    $mail->CharSet = 'UTF-8';
    $mail->From = $fmail;
    $mail->FromName = $fname;
    $mail->Subject = $subject;
    $mail->AltBody = "";
    // optional, comment out and test
    $mail->msgHTML($content);
    $mail->addAddress($to);
    if ($cc) {
        $mail->addCC($cc);
    }
    if ($bcc) {
        $mail->addBCC($bcc);
    }
    //print_r2($file); exit;
    if ($file != "") {
        foreach ($file as $f) {
            $mail->addAttachment($f['path'], $f['name']);
        }
    }
    return $mail->send();
}
Example #28
0
 function send($to, $subject, $content, $sender)
 {
     //echo 'sendmail!!';
     require_once ROOT . DS . 'library' . DS . 'class.phpmailer.php';
     $mail = new PHPMailer();
     $mail->CharSet = "UTF-8";
     $mail->SetLanguage('vi', ROOT . DS . 'library' . '/phpmailer/language/');
     $mail->IsSMTP();
     $mail->SMTPAuth = true;
     // enable SMTP authentication
     $mail->SMTPSecure = "ssl";
     // sets the prefix to the servier
     //$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
     //$mail->Port       = 465;                   // set the SMTP port for the GMAIL server
     $mail->Host = $sender['smtp'];
     $mail->Port = $sender['port'];
     $mail->Username = $sender['email'];
     // GMAIL username
     $mail->Password = $sender['password'];
     // GMAIL password
     $from = $sender['email'];
     $mail->AddReplyTo('*****@*****.**', "Jobbid.vn Support");
     $mail->From = $from;
     $mail->FromName = "Jobbid.vn Support";
     $mail->Sender = $from;
     $mail->Subject = $subject;
     //$mail->AltBody    = "Xin chao"; // optional, comment out and test
     //$mail->WordWrap   = 50; // set word wrap
     $mail->MsgHTML($content);
     if (is_array($to)) {
         foreach ($to as $email) {
             $mail->addBCC($email);
         }
     } else {
         $mail->AddAddress($to);
     }
     $mail->IsHTML(true);
     // send as HTML
     if (!$mail->Send()) {
         return false;
     }
     $mail->SmtpClose();
     return true;
 }
Example #29
0
function sendMail($info)
{
    require 'PHPMailerAutoload.php';
    $mail = new PHPMailer();
    //$mail->SMTPDebug = 3;                               // Enable verbose debug output
    $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 username
    $mail->Password = '******';
    // SMTP password
    $mail->SMTPSecure = 'tls';
    // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 587;
    // TCP port to connect to
    $mail->From = $info['from_email'];
    $mail->FromName = $info['from_name'];
    $mail->addAddress($info['to_email'], $info['to_name']);
    // Add a recipient
    //$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 = $info['subject'];
    $mail->Body = $info['body'];
    //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
    if (!$mail->send()) {
        //echo 'Message could not be sent.';
        //echo 'Mailer Error: ' . $mail->ErrorInfo;
        return false;
    } else {
        //echo 'Message has been sent';
        return true;
    }
}
 public function sendEmail($inputemail, $inputSubject, $body)
 {
     $adder = $this->db->prepare("INSERT INTO paymentemails (recieverEmail,subject,body)\n        VALUES(:inputemail,:inputSubject,:body)");
     $adder->execute(array(':recieverEmail' => $inputemail, ':subject' => $inputSubject, ':body' => $body));
     require_once '/public/email/PHPMailer/PHPMailerAutoload.php';
     $mail = new PHPMailer();
     //$mail->SMTPDebug = 1;                               // Enable verbose debug output
     $mail->isSMTP();
     // Set mailer to use SMTP
     $mail->Host = 'ssl://smtp.gmail.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;
     // TCP port to connect to
     $mail->From = '*****@*****.**';
     $mail->FromName = 'TrainXLife';
     $mail->addAddress($emails, $fname);
     // Add a recipient
     //$mail->addAddress('*****@*****.**');               // Name is optional
     $mail->addReplyTo('*****@*****.**', 'TrainXLife');
     //$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 = $subject;
     $mail->Body = $body;
     $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
     if (!$mail->send()) {
         echo 'Message could not be sent.';
         echo 'Mailer Error: ' . $mail->ErrorInfo;
     } else {
         echo 'Message has been sent';
     }
 }