function sendMail($correoUsuario, $correoCliente, $archivo)
 {
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->SMTPAuth = true;
     $mail->Host = SMTP;
     $mail->SMTPSecure = SSL;
     $mail->Username = USERNAME;
     $mail->Password = PASSWORDSMTP;
     $mail->CharSet = "UTF-8";
     $mail->Port = PORT;
     $mail->From = FROM;
     $mail->FromName = FROMNAME;
     $mail->Subject = 'Propuesta Comercial Voy';
     $mail->WordWrap = WORDWRAP;
     $mail->IsHTML(true);
     $mail->MsgHTML($this->bodyMailTable());
     $mail->AddReplyTo(FROM, FROMNAME);
     $mail->AddAttachment('folder/' . $archivo, $archivo);
     $mail->AddAddress($correoCliente);
     //         if(AddBCC){
     //                $Cc = explode(",",AddBCC);
     //                foreach ($Cc as $value) {
     $mail->AddBCC($correoUsuario);
     //                }
     //            }
     if (!$mail->Send()) {
         echo "Error de envío de email: " . $mail->ErrorInfo;
         exit;
     } else {
         return;
     }
 }
Example #2
1
function sendMail($to, $subject, $message, $fromAddress = '', $fromUserName = '', $toName = '', $bcc = '', $upload_dir = '', $filename = '')
{
    try {
        $mail = new PHPMailer();
        $mail->IsSMTP();
        $mail->Host = "sm4.siteground.biz";
        $mail->Port = 2525;
        $mail->SMTPAuth = true;
        $mail->SMTPDebug = 1;
        // enables SMTP debug information (for testing)
        // Enable SMTP authentication
        $mail->Username = '******';
        // SMTP username
        $mail->Password = '******';
        // SMTP password
        $mail->IsHTML(true);
        $mail->ClearAddresses();
        $find = strpos($to, ',');
        if ($find) {
            $ids = explode(',', $to);
            for ($i = 0; $i < count($ids); $i++) {
                $mail->AddAddress($ids[$i]);
            }
        } else {
            $mail->AddAddress($to);
        }
        if ($fromAddress != '') {
            $mail->From = $fromAddress;
        } else {
            $mail->From = "*****@*****.**";
        }
        if ($fromUserName != '') {
            $mail->FromName = $fromUserName;
        } else {
            $mail->FromName = "Video Collections";
        }
        $mail->WordWrap = 50;
        $mail->IsHTML(true);
        $mail->Subject = $subject;
        $mail->Body = $message;
        if ($upload_dir != '') {
            foreach ($upload_dir as $uploaddirs) {
                $mail->AddAttachment($uploaddirs, $filename);
            }
        }
        if ($mail->Send()) {
            return 1;
        } else {
            return 0;
        }
    } catch (phpmailerException $e) {
        echo $e->errorMessage();
        //Pretty error messages from PHPMailer
    } catch (Exception $e) {
        echo $e->getMessage();
        //Boring error messages from anything else!
    }
}
function sendMail($to, $subject, $message, $fromAddress = '', $fromUserName = '', $toName = '', $bcc = '', $upload_dir = '', $filename = '')
{
    $mail = new PHPMailer();
    $mail->IsSMTP();
    // send via SMTP
    $mail->Host = "smtp.gmail.com";
    // SMTP servers
    $mail->SMTPAuth = true;
    // enable SMTP authentication
    $mail->SMTPSecure = "ssl";
    // use ssl
    //$mail->Host = "mail.vivateachers.org"; // GMAIL's SMTP server
    $mail->Port = 465;
    // SMTP port used by GMAIL server
    $mail->IsHTML(true);
    // [optional] send as HTML
    $mail->Username = "******";
    // SMTP username
    $mail->Password = "******";
    // SMTP password
    $mail->ClearAddresses();
    $find = strpos($to, ',');
    if ($find) {
        $ids = explode(',', $to);
        for ($i = 0; $i < count($ids); $i++) {
            $mail->AddAddress($ids[$i]);
        }
    } else {
        $mail->AddAddress($to);
    }
    if ($fromAddress != '') {
        $mail->From = $fromAddress;
    } else {
        $mail->From = "*****@*****.**";
    }
    if ($fromUserName != '') {
        $mail->FromName = $fromUserName;
    } else {
        $mail->FromName = "MediCart";
    }
    $mail->WordWrap = 50;
    $mail->IsHTML(true);
    $mail->Subject = $subject;
    $mail->Body = $message;
    if ($upload_dir != '') {
        foreach ($upload_dir as $uploaddirs) {
            $mail->AddAttachment($uploaddirs, $filename);
        }
    }
    if ($mail->Send()) {
        return 1;
    } else {
        return 0;
    }
}
Example #4
1
 public function handle($fromTitle, $fromMail, $toEmail, $subject, $body, $attachments, $smtpHost, $smtpPort, $serverLogin = '', $serverPassword = '', $charCode = 'UTF-8', $isHtml = false)
 {
     if (!is_object($this->_mail)) {
         $this->_mail = new PHPMailer();
     }
     $this->_mail->CharSet = $charCode;
     $this->_mail->IsHTML($isHtml);
     $this->_mail->From = $fromMail;
     $this->_mail->FromName = $fromTitle;
     $this->_mail->AddReplyTo($fromMail, $fromTitle);
     $this->_mail->Subject = $subject;
     $this->_mail->Body = $body;
     $this->_mail->AltBody = '';
     $this->_mail->AddAddress($toEmail, '');
     $this->_mail->IsSMTP(true);
     $this->_mail->Mailer = 'smtp';
     $this->_mail->Host = $smtpHost;
     $this->_mail->Port = $smtpPort;
     if ($serverLogin != '') {
         $this->_mail->SMTPAuth = true;
         $this->_mail->Username = $serverLogin;
         $this->_mail->Password = $serverPassword;
     } else {
         $this->_mail->SMTPAuth = false;
         $this->_mail->Username = '';
         $this->_mail->Password = '';
     }
     if (is_object($attachments)) {
         //FIXME
         //        // zalaczniki
         //for ($z = 0; $z < Count($tab_mail_oma_zalacznik[$tab_mail_id[$i]]); $z++) {
         //if (($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z] != '') AND (file_exists($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z]))) {
         //if ($tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z] == '') {
         //$this->_mail->AddAttachment($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z], basename($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z]));
         //} // koniec if...
         //else {
         //$this->_mail->AddEmbeddedImage($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z], $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z]);
         //$tmp_tresc = str_replace('[' . $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z] . ']', 'cid:' . $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z], $tmp_tresc);
         //} // koniec else...
         //} // koniec if...
         //} // koniec for...
     }
     if (!$this->_mail->Send()) {
         $status = false;
     } else {
         $status = true;
     }
     $this->_mail->ClearAddresses();
     $this->_mail->ClearAttachments();
     return $status;
 }
Example #5
1
function EmailError($errorText)
{
    require_once "phpmailer/class.phpmailer.php";
    $mail = new PHPMailer();
    if (EMAIL_ERROR_MESSAGES) {
        $mail->IsSMTP('true');
        // set mailer to use SMTP
        $mail->Host = "192.168.50.27";
        // specify main and backup server
        $mail->SMTPAuth = false;
        // turn on SMTP authentication
        $mail->Username = "";
        // SMTP username
        $mail->Password = "";
        // SMTP password
        $mail->From = "*****@*****.**";
        $mail->FromName = "Error on Snowball";
        $mail->WordWrap = 70;
        // set word wrap to 70 characters
        $mail->Subject = 'PHP Server Error';
        $text = "The following error just occured:\r\nMessage: {$errorText}\r\n";
        $mail->AddAddress('*****@*****.**');
        $mail->IsHTML(false);
        $mail->Body = $text;
        $mail->Send();
    }
}
 function sendEmailNotifier($contactUsEntry)
 {
     assert(isset($contactUsEntry) && $contactUsEntry != "");
     $isSuccessful = false;
     $mail = new PHPMailer();
     //$mail->IsSMTP();                                            // telling the class to use SMTP
     $mail->SMTPDebug = 0;
     // enables SMTP debug information (for testing)
     //$mail->SMTPAuth     = TRUE;                                 // enable SMTP authentication
     //$mail->SMTPSecure   = "ssl";                                // sets the prefix to the server
     //$mail->Host         = "smtp.gmail.com";                     // sets GMAIL as the SMTP server
     //$mail->Port         = 465;                                  // set the SMTP port for the GMAIL server
     $mail->IsHTML(TRUE);
     // gmail account to use to send the email
     //$mail->Username     = "******";
     //$mail->Password     = "******";
     //$mail->SetFrom("*****@*****.**");
     $mail->AddAddress(CONTACT_US_EMAIL, "Contact Us");
     //$mail->AddCC("*****@*****.**", "Clinton Fong");
     $mail->Subject = "Contact Us Message from Online Diaries Website";
     $msg = "Firstname: {$contactUsEntry->firstname} <br />";
     $msg .= "Lastname: {$contactUsEntry->lastname} <br />";
     $msg .= "Email: {$contactUsEntry->email}<br />";
     $msg .= "Message: {$contactUsEntry->message}<br>";
     $mail->Body = $msg;
     // Mail it
     $isSuccessful = $mail->Send();
     /*                
             if( !$isSuccessful )
             {
                 //$strResult         .= " Mailer error: {$mail->ErrorInfo}";
             }
     */
     return $isSuccessful;
 }
Example #7
0
 public function send()
 {
     $mail = new PHPMailer();
     foreach ($this->to as $to) {
         $mail->AddAddress($to);
     }
     $mail->IsMail();
     $mail->Subject = $this->subject;
     $mail->From = MAIL_REPLY_TO;
     $mail->FromName = $this->fromName ?: MAIL_FROM_NAME;
     $mail->Sender = MAIL_REPLY_TO;
     if ($this->replyTo) {
         $mail->AddReplyTo($this->replyTo);
     }
     $mail->Body = $this->body;
     if (substr(trim($this->body), 0, 1) == '<') {
         $mail->IsHTML(true);
         if (isset($this->plain_body)) {
             $mail->AltBody = html_entity_decode($this->plain_body);
         }
     } else {
         $mail->Body = html_entity_decode($this->body);
         $mail->IsHTML(false);
     }
     if (IS_PRODUCTION) {
         return $mail->Send();
     } else {
         \jmvc::log(print_r($mail, true), 'mail');
     }
 }
 function kdmail($f)
 {
     $this->load('lib/phpmailer/class.phpmailer');
     $mail = new PHPMailer();
     //$body             = $mail->getFile(ROOT.'index.php');
     //$body             = eregi_replace("[\]",'',$body);
     $mail->IsSendmail();
     // telling the class to use SendMail transport
     $mail->From = $f["from"];
     $mail->FromName = either($f["fromname"], "noticer");
     $mail->Subject = either($f["subject"], "hello");
     //$mail->AltBody = either($f["altbody"], "To view the message, please use an HTML compatible email viewer!"); // optional, comment out and test
     $mail->AltBody = either($f["msg"], "To view the message, please use an HTML compatible email viewer!");
     // optional, comment out and test
     if ($f["embedimg"]) {
         foreach ($f["embedimg"] as $i) {
             //$mail->AddEmbeddedImage(ROOT."public/images/logo7.png","logo","logo7.png");
             $mail->AddEmbeddedImage($i[0], $i[1], $i[2]);
         }
     }
     if ($f["msgfile"]) {
         $body = $mail->getFile($f["msgfile"]);
         $body = eregi_replace("[\\]", '', $body);
         if ($f["type"] == "text") {
             $mail->IsHTML(false);
             $mail->Body = $body;
         } else {
             $mail->MsgHTML($body);
             //."<br><img src= \"cid:logo\">");
         }
     } else {
         if ($f["type"] == "text") {
             $mail->IsHTML(false);
             $mail->Body = $f["msg"];
         } else {
             $mail->MsgHTML($f["msg"]);
             //."<br><img src= \"cid:logo\">");
         }
     }
     if (preg_match('/\\,/', $f["to"])) {
         $emails = explode(",", $f["to"]);
         foreach ($emails as $i) {
             $mail->AddAddress($i, $f["toname"]);
         }
     } else {
         $mail->AddAddress($f["to"], $f["toname"]);
     }
     $mail->AddBCC($this->config["site"]["mail"], "bcc");
     if ($f["files"]) {
         foreach ($f["files"] as $i) {
             $mail->AddAttachment($i);
             // attachment
         }
     }
     if (!$mail->Send()) {
         return "Mailer Error: " . $mail->ErrorInfo;
     } else {
         return "Message sent!";
     }
 }
Example #9
0
	/**
	 * Método para carregar o objeto PHPMailer
	 * @return \PHPMailer
	 */
	public function carregar() {
		$dados = \controlador\Facil::getDadosIni();

		require(LIB . DS . "PHPMailer/class.phpmailer.php");

		$this->mailer = new \PHPMailer();
		if ($dados['email']['smtp']) {
			$this->mailer->IsSMTP();
			$this->mailer->Host = $dados['email']['host'];
			$this->mailer->SMTPAuth = $dados['email']['autenticar'];
			$this->mailer->Username = $dados['email']['usuario'];
			$this->mailer->Password = $dados['email']['senha'];
		}

		$this->mailer->From = $dados['email']['from_email'];
		$this->mailer->FromName = $dados['email']['from_nome'];
		$this->mailer->IsHTML($dados['email']['html']);
		$this->mailer->WordWrap = $dados['email']['wordwrap'];
		$this->mailer->AddReplyTo($this->mailer->From);

		$this->mailer->CharSet = $dados['l10n']['charset'];

		return $this->mailer;

	}
Example #10
0
 /**
  * send an email
  *
  * @param string $toaddress
  * @param string $toname
  * @param string $subject
  * @param string $mailtext
  * @param string $fromaddress
  * @param string $fromname
  * @param bool $html
  */
 public static function send($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '')
 {
     $SMTPMODE = OC_Config::getValue('mail_smtpmode', 'sendmail');
     $SMTPHOST = OC_Config::getValue('mail_smtphost', '127.0.0.1');
     $SMTPAUTH = OC_Config::getValue('mail_smtpauth', false);
     $SMTPUSERNAME = OC_Config::getValue('mail_smtpname', '');
     $SMTPPASSWORD = OC_Config::getValue('mail_smtppassword', '');
     $mailo = new PHPMailer(true);
     if ($SMTPMODE == 'sendmail') {
         $mailo->IsSendmail();
     } elseif ($SMTPMODE == 'smtp') {
         $mailo->IsSMTP();
     } elseif ($SMTPMODE == 'qmail') {
         $mailo->IsQmail();
     } else {
         $mailo->IsMail();
     }
     $mailo->Host = $SMTPHOST;
     $mailo->SMTPAuth = $SMTPAUTH;
     $mailo->Username = $SMTPUSERNAME;
     $mailo->Password = $SMTPPASSWORD;
     $mailo->From = $fromaddress;
     $mailo->FromName = $fromname;
     $mailo->Sender = $fromaddress;
     $a = explode(' ', $toaddress);
     try {
         foreach ($a as $ad) {
             $mailo->AddAddress($ad, $toname);
         }
         if ($ccaddress != '') {
             $mailo->AddCC($ccaddress, $ccname);
         }
         if ($bcc != '') {
             $mailo->AddBCC($bcc);
         }
         $mailo->AddReplyTo($fromaddress, $fromname);
         $mailo->WordWrap = 50;
         if ($html == 1) {
             $mailo->IsHTML(true);
         } else {
             $mailo->IsHTML(false);
         }
         $mailo->Subject = $subject;
         if ($altbody == '') {
             $mailo->Body = $mailtext . OC_MAIL::getfooter();
             $mailo->AltBody = '';
         } else {
             $mailo->Body = $mailtext;
             $mailo->AltBody = $altbody;
         }
         $mailo->CharSet = 'UTF-8';
         $mailo->Send();
         unset($mailo);
         OC_Log::write('mail', 'Mail from ' . $fromname . ' (' . $fromaddress . ')' . ' to: ' . $toname . '(' . $toaddress . ')' . ' subject: ' . $subject, OC_Log::DEBUG);
     } catch (Exception $exception) {
         OC_Log::write('mail', $exception->getMessage(), OC_Log::ERROR);
         throw $exception;
     }
 }
Example #11
0
function sendemail($toname, $toemail, $fromname, $fromemail, $subject, $message, $type = "plain", $cc = "", $bcc = "")
{
    global $settings, $locale;
    require_once INCLUDES . "class.phpmailer.php";
    $mail = new PHPMailer();
    if (file_exists(INCLUDES . "language/phpmailer.lang-" . $locale['phpmailer'] . ".php")) {
        $mail->SetLanguage($locale['phpmailer'], INCLUDES . "language/");
    } else {
        $mail->SetLanguage("en", INCLUDES . "language/");
    }
    if (!$settings['smtp_host']) {
        $mail->IsMAIL();
    } else {
        $mail->IsSMTP();
        $mail->Host = $settings['smtp_host'];
        $mail->Port = $settings['smtp_port'];
        $mail->SMTPAuth = $settings['smtp_auth'] ? true : false;
        $mail->Username = $settings['smtp_username'];
        $mail->Password = $settings['smtp_password'];
    }
    $mail->CharSet = $locale['charset'];
    $mail->From = $fromemail;
    $mail->FromName = $fromname;
    $mail->AddAddress($toemail, $toname);
    $mail->AddReplyTo($fromemail, $fromname);
    if ($cc) {
        $cc = explode(", ", $cc);
        foreach ($cc as $ccaddress) {
            $mail->AddCC($ccaddress);
        }
    }
    if ($bcc) {
        $bcc = explode(", ", $bcc);
        foreach ($bcc as $bccaddress) {
            $mail->AddBCC($bccaddress);
        }
    }
    if ($type == "plain") {
        $mail->IsHTML(false);
    } else {
        $mail->IsHTML(true);
    }
    $mail->Subject = $subject;
    $mail->Body = $message;
    if (!$mail->Send()) {
        $mail->ErrorInfo;
        $mail->ClearAllRecipients();
        $mail->ClearReplyTos();
        return false;
    } else {
        $mail->ClearAllRecipients();
        $mail->ClearReplyTos();
        return true;
    }
}
Example #12
0
 public function run()
 {
     $data = $this->job->getData();
     $config = Config::getInstance();
     $mail = new \PHPMailer();
     // Enable SMTP if required:
     if (isset($config->site['smtp_server'])) {
         $mail->IsSMTP();
         $mail->SMTPAuth = true;
         $mail->Host = $config->get('site.smtp_server', null);
         $mail->Username = $config->get('site.smtp_username', null);
         $mail->Password = $config->get('site.smtp_password', null);
     }
     // Is this email a HTML email?
     $mail->IsHTML(false);
     if (!empty($data['html']) && $data['html']) {
         $mail->IsHTML(true);
     }
     $mail->Subject = $data['subject'];
     $mail->CharSet = "UTF-8";
     // Handle recipients and CCs:
     foreach ($data['to'] as $recipient) {
         $mail->addAddress($recipient['email'], $recipient['name']);
     }
     if (isset($data['cc']) && is_array($data['cc'])) {
         foreach ($data['cc'] as $recipient) {
             $mail->addCc($recipient['email'], $recipient['name']);
         }
     }
     // Handle Reply To:
     if (isset($data['reply_to']) && is_array($data['reply_to'])) {
         $mail->addReplyTo($data['reply_to']['email'], $data['reply_to']['name']);
     }
     // Handle From:
     if (isset($config->site['email_from'])) {
         $mail->SetFrom($config->site['email_from'], $config->site['email_from_name']);
     }
     // Handle attachments:
     if (isset($data['attachments']) && is_array($data['attachments'])) {
         foreach ($data['attachments'] as $name => $path) {
             $mail->addAttachment($path, $name);
         }
     }
     $mail->Body = $data['body'];
     if (!$mail->send()) {
         throw new Exception($mail->ErrorInfo);
     }
     return true;
 }
Example #13
0
function Sendemail($to, $subject, $message, $repyto, $from, $fromname)
{
    try {
        $mail = new PHPMailer(true);
        //New instance, with exceptions enabled
        $mail->IsSMTP();
        // tell the class to use SMTP
        $mail->SMTPAuth = false;
        // enable SMTP authentication
        $mail->IsSendmail();
        // tell the class to use Sendmail
        $mail->AddReplyTo($repyto, $fromname);
        $mail->From = $from;
        $mail->FromName = $fromname;
        $mail->AddAddress($to);
        $mail->Subject = $subject;
        $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
        // optional, comment out and test
        $mail->WordWrap = 80;
        // set word wrap
        $mail->MsgHTML($message);
        $mail->IsHTML(true);
        // send as HTML
        $mail->Send();
        return true;
    } catch (phpmailerException $e) {
        //echo $e->errorMessage();
    }
}
function Send_Mail($to, $subject, $body)
{
    require 'class.phpmailer.php';
    $from = "*****@*****.**";
    $mail = new PHPMailer();
    $mail->IsSMTP(true);
    // use SMTP
    $mail->IsHTML(true);
    $mail->SMTPAuth = true;
    // enable SMTP authentication
    $mail->Host = "tls://smtp.gmail.com";
    // Amazon SES server, note "tls://" protocol
    $mail->Port = 465;
    // set the SMTP port
    $mail->Username = "******";
    // SMTP  username
    $mail->Password = "******";
    // SMTP password
    $mail->SetFrom($from, 'Find Your Perfect Roommate');
    $mail->AddReplyTo($from, 'Reply to Find Your Perfect Roommate');
    $mail->Subject = $subject;
    $mail->MsgHTML($body);
    $address = $to;
    $mail->AddAddress($address, $to);
    $mail->Send();
}
Example #15
0
function smtpMailer($to, $from, $from_name, $subject, $body)
{
    $mail = new \PHPMailer();
    // Cree un nouvel objet PHPMailer
    $mail->IsSMTP();
    // active SMTP
    $mail->IsHTML(true);
    $mail->CharSet = "utf-8";
    $mail->SMTPDebug = 0;
    // debogage: 1 = Erreurs et messages, 2 = messages seulement
    $mail->SMTPAuth = true;
    // Authentification SMTP active
    $mail->SMTPSecure = 'ssl';
    // Gmail REQUIERT Le transfert securise
    $mail->Host = 'smtp.gmail.com';
    $mail->Port = 465;
    $mail->Username = GMailUSER;
    $mail->Password = GMailPWD;
    $mail->SetFrom($from, $from_name);
    $mail->Subject = $subject;
    $mail->Body = $body;
    $mail->AddAddress($to);
    $mail->setLanguage('fr', '/optional/path/to/language/directory/');
    //debug($mail);
    if (!$mail->Send()) {
        $errorMail = 'Mail error: ' . $mail->ErrorInfo;
    }
}
Example #16
0
function smtpmailer($to, $from, $from_name, $subject, $avatar, $user, $link)
{
    global $error;
    $mail = new PHPMailer();
    // create a new object
    $mail->IsSMTP();
    // enable SMTP
    $mail->SMTPDebug = 0;
    // debugging: 1 = errors and messages, 2 = messages only
    $mail->SMTPAuth = true;
    // authentication enabled
    $mail->SMTPSecure = 'ssl';
    // secure transfer enabled REQUIRED for GMail
    $mail->Host = 'smtp.gmail.com';
    $mail->Port = 465;
    $mail->Username = GUSER;
    $mail->Password = GPWD;
    $mail->IsHTML(true);
    $mail->SetFrom($from, $from_name);
    $mail->Subject = $subject;
    $mail->AddEmbeddedImage('background1.jpg', 'background1img');
    $name = explode($avatar, '.');
    $mail->AddEmbeddedImage('templates/avatars/' . $avatar, 'avatarimg');
    $mail->Body = "<div style='width:100%;background-color:rgb(77, 16, 1);height:500px;font-size:20px;color:#fff'>\n\t\t<font face='century Gothic,sans-serif'>\n\t\t<img src='cid:background1img' style='z-index:-2;text-align:center;margin-left:195px;width:300px;'>\n\t\t\n\t\t<div style='margin-left:0px;margin-top:30px;text-align:center;'><img src='cid:avatarimg' style='width:100px;height:100px;padding:1px;border:3px solid #ddd;margin-top:5px;margin-left:-5px;' /><div style='margin-top:5px;margin-left:-5px;'>Hello " . $user . "</div>\n\t\t\t<p style='text-align:justify;max-width:500px;margin-left:120px;'>\"Campus Connect\" is an initiative by a group of student enthusiasts, aiming to solve some of the issues faced by BITSians.\"BITS QUORA\" is one of the many projects covered under this initiative. </p>\n\t\t\n\t\t<div style='text-align:center'><br>\n\t\t<p style='text-align:center'><a href='http://BITSQ/register.php?token=" . $link . "&mail=" . $to . "' style='margin-top:18px;color:#fff;text-decoration:none;cursor:pointer;background:green;padding:6px;border:2 px solid darkgreen;border-radius:2px'>Click here to confirm your mail.</a></p> </div>\n\t\t</div>\n\t\t<div style='color:#fff;font-size:18px;position:absolute;bottom:0px;margin-left:100px;'>\n\t\tRegards<br>\n\t\tAkhil Reddy<br>\n\t\tH-Rep VK-BHAWAN<br>\n\t\t7728835792<br><br>\n\t\t</div>\t\t\n\t\t</div>\n\t\t</font></div>";
    $mail->AddAddress($to);
    if (!$mail->Send()) {
        $error = 'Mail error: ' . $mail->ErrorInfo;
        return false;
    } else {
        $error = 'Confirmation Mail sent to the the provided mail!';
        return true;
    }
}
Example #17
0
 /**
  * Send a email with the given message and title. Targets are in array form >   array("name" => "Target's name", "email" => "Target's email address")
  * @param $message
  * @param $title
  * @param array $target
  * @return bool
  * @throws Exception
  * @throws phpmailerException
  */
 public function sendMail($message, $title, $target = array())
 {
     if (!class_exists('PHPMailer')) {
         throw new Exception("Couldn't find PHPMailer class!");
     }
     $mail = new \PHPMailer();
     // create a new object
     $mail->IsSMTP();
     // enable SMTP
     if (ADVANCEDLOGINSCRIPT_DEBUG) {
         $mail->SMTPDebug = 1;
         // debugging: 1 = errors and messages, 2 = messages only
         $mail->SMTPOptions = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true));
     } else {
         $mail->SMTPDebug = 0;
     }
     $mail->SMTPAuth = true;
     $mail->SMTPSecure = 'tls';
     $mail->Host = ADVANCEDLOGINSCRIPT_EMAIL_HOST;
     $mail->Port = 587;
     $mail->IsHTML(true);
     $mail->Username = ADVANCEDLOGINSCRIPT_EMAIL_USERNAME;
     $mail->Password = ADVANCEDLOGINSCRIPT_EMAIL_PASSWORD;
     $mail->SetFrom(ADVANCEDLOGINSCRIPT_EMAIL_USERNAME);
     $mail->Subject = $title;
     $mail->Body = $message;
     $mail->Timeout = 10;
     // set the timeout (seconds)
     foreach ($target as $person) {
         $mail->addAddress($person['email'], $person['name']);
     }
     return $mail->Send();
 }
Example #18
0
/**
* 
*/
function sendMail($to, $title, $content)
{
    Vendor('PHPMailer.PHPMailerAutoload');
    $mail = new PHPMailer();
    //实例化
    $mail->IsSMTP();
    // 启用SMTP
    $mail->Host = C('MAIL_HOST');
    //smtp服务器的名称(这里以QQ邮箱为例)
    $mail->SMTPAuth = C('MAIL_SMTPAUTH');
    //启用smtp认证
    $mail->Username = C('MAIL_USERNAME');
    //你的邮箱名
    $mail->Password = C('MAIL_PASSWORD');
    //邮箱密码
    $mail->From = C('MAIL_FROM');
    //发件人地址(也就是你的邮箱地址)
    $mail->FromName = C('MAIL_FROMNAME');
    //发件人姓名
    $mail->AddAddress($to, "尊敬的客户");
    $mail->WordWrap = 50;
    //设置每行字符长度
    $mail->IsHTML(C('MAIL_ISHTML'));
    // 是否HTML格式邮件
    $mail->CharSet = C('MAIL_CHARSET');
    //设置邮件编码
    $mail->Subject = $title;
    //邮件主题
    $mail->Body = $content;
    //邮件内容
    $mail->AltBody = "这是一个纯文本的身体在非营利的HTML电子邮件客户端";
    //邮件正文不支持HTML的备用显示
    return $mail->Send();
}
Example #19
0
function email($contas)
{
    global $CONFIG_smtp_server, $CONFIG_smtp_port, $CONFIG_smtp_username, $CONFIG_smtp_password, $CONFIG_smtp_mail, $CONFIG_name;
    $mensagem = "----------------------------\n";
    for ($i = 0; isset($contas[$i][0]); $i++) {
        $mensagem .= "Username: "******"\nPassword: "******"\n----------------------------\n";
    }
    $maildef = read_maildef("recover_password");
    $maildef = str_ireplace("#account_info#", $mensagem, $maildef);
    $maildef = str_ireplace("#server_name#", $CONFIG_name, $maildef);
    $maildef = str_ireplace("#support_mail#", $CONFIG_smtp_mail, $maildef);
    $maildef = nl2br($maildef);
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPAuth = true;
    $mail->Host = $CONFIG_smtp_server;
    $mail->Port = $CONFIG_smtp_port;
    $mail->Username = $CONFIG_smtp_username;
    $mail->Password = $CONFIG_smtp_password;
    $mail->From = $CONFIG_smtp_mail;
    $mail->FromName = $CONFIG_name;
    $mail->Subject = "Password Recovery";
    $mail->Body = $maildef;
    $mail->WordWrap = 50;
    $mail->AddAddress($contas[0][2], $contas[0][2]);
    $mail->AddReplyTo($CONFIG_smtp_mail, $CONFIG_name);
    $mail->IsHTML(true);
    if (!$mail->Send()) {
        return $mail->ErrorInfo;
    } else {
        return "Message has been sent";
    }
}
Example #20
0
function smtpmailer($para, $de, $de_nome, $assunto, $corpo, $tipo)
{
    if ($tipo == 0) {
        include "./phpmailer/class.phpmailer.php";
    } else {
        include "../phpmailer/class.phpmailer.php";
    }
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->IsHTML(true);
    $mail->SMTPDebug = 1;
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = 'ssl';
    $mail->Host = "smtp.gmail.com";
    $mail->Port = 465;
    $mail->Username = "******";
    $mail->Password = "******";
    $mail->SetFrom($de, $de_nome);
    $mail->Subject = $assunto;
    $mail->Body = $corpo;
    $mail->AddAddress($para);
    if (!$mail->Send()) {
        $erro = 'Erro: ' . $mail->ErrorInfo;
        return $erro;
    } else {
        return 'Informações enviadas para o seu e-mail!';
    }
}
Example #21
0
/**
 * 邮件发送函数
 * @param string to      要发送的邮箱地址
 * @param string subject 邮件标题
 * @param string content 邮件内容
 * @return array
 */
function WSTSendMail($to, $subject, $content)
{
    require_cache(VENDOR_PATH . "PHPMailer/class.smtp.php");
    require_cache(VENDOR_PATH . "PHPMailer/class.phpmailer.php");
    $mail = new PHPMailer();
    // 装配邮件服务器
    $mail->IsSMTP();
    $mail->SMTPDebug = 0;
    $mail->Host = $GLOBALS['CONFIG']['mailSmtp'];
    $mail->SMTPAuth = $GLOBALS['CONFIG']['mailAuth'];
    $mail->Username = $GLOBALS['CONFIG']['mailUserName'];
    $mail->Password = $GLOBALS['CONFIG']['mailPassword'];
    $mail->CharSet = 'utf-8';
    // 装配邮件头信息
    $mail->From = $GLOBALS['CONFIG']['mailUserName'];
    $mail->AddAddress($to);
    $mail->FromName = $GLOBALS['CONFIG']['mailSendTitle'];
    $mail->IsHTML(true);
    // 装配邮件正文信息
    $mail->Subject = $subject;
    $mail->Body = $content;
    // 发送邮件
    $rs = array();
    if (!$mail->Send()) {
        $rs['status'] = 0;
        $rs['msg'] = $mail->ErrorInfo;
        return $rs;
    } else {
        $rs['status'] = 1;
        return $rs;
    }
}
Example #22
0
 function form()
 {
     if ($this->request->data) {
         $this->loadModel(CONTACT);
         $mail = new PHPMailer();
         $mail->From = $this->request->data->mail;
         $mail->FromName = $this->request->data->name;
         $message = $this->request->data->content;
         if ($this->request->data->sendcopy == 1) {
             $mail->AddAddress($this->request->data->mail);
             $message .= "<div><div dir=\"ltr\"><div><span style=\"color:rgb(11,83,148)\">Bien à vous,<i><b><br></b></span></span></div><div><span style=\"color:rgb(11,83,148)\"><i><b><br>WebPassions</b><br></span></span></div><div><span style=\"color:rgb(11,83,148)\">Lorge Vivian<br></span></div><div><span style=\"color:rgb(11,83,148)\"><i>0479/95.98.45</span><br></span></div><span style=\"color:rgb(11,83,148)\"><a target=\"_blank\" href=\"http://www.webpassions.be\"><i>http://www.webpassions.be</span></a></span><br><div><br><div><img width=\"96\" height=\"28\" src=\"http://www.webpassions.be/signature.png\"><br><br><br></div></div></div></div>";
         }
         $mail->IsHTML(true);
         $mail->CharSet = 'UTF-8';
         $mail->AddAddress($_SESSION['cmscontact']);
         $mail->AddReplyTo($_SESSION['cmscontact']);
         $mail->Subject = $_SESSION['cmscontactcategory'][$this->request->data->subject];
         $mail->Body = $message;
         if (!$mail->Send()) {
             $this->logger->LogError($this->request->controller, $this->request->action, $_SESSION[USER]->login, BackendTranslate::getLabel('send_error') . $mail->ErrorInfo);
             $this->Session->setAlert(BackendTranslate::getLabel('send_error') . $mail->ErrorInfo, DANGER);
         } else {
             $this->logger->LogInfo($this->request->controller, $this->request->action, $_SESSION[USER]->login, BackendTranslate::getLabel('send_mail'));
             $this->Session->setAlert(BackendTranslate::getLabel('send_mail'), SUCCESS);
         }
         unset($mail);
     }
 }
Example #23
0
 public static function sendMail($recipients, $subject, $content)
 {
     $cfg = CfgHelper::getInstance();
     $mail = new PHPMailer();
     // recipients
     if (is_array($recipients)) {
         foreach ($recipients as $r) {
             $mail->AddAddress($r);
         }
     } else {
         if (is_string($recipients)) {
         } else {
             Debug::loge('Wrong recipients parameter ! Should be an array or a string...', 'MailHelper');
             return;
         }
     }
     // sender
     $mail->From = $cfg->getMailFromAddr();
     $mail->FromName = $cfg->getMailFromName();
     $mail->IsHTML(true);
     // Set email format to HTML
     $mail->Subject = $subject;
     $mail->Body = $content;
     if (!$mail->Send()) {
         Debug::loge('Message could not be sent. Mailer Error: ' . $mail->ErrorInfo, 'MailHelper');
     }
 }
Example #24
0
function Send_Mail($to, $subject, $body)
{
    require 'class.phpmailer.php';
    $from = "*****@*****.**";
    $mail = new PHPMailer();
    $mail->IsSMTP(true);
    // use SMTP
    $mail->IsHTML(true);
    $mail->SMTPAuth = true;
    // enable SMTP authentication
    $mail->Host = "smtp.mandrillapp.com";
    // Mandrillapp.com SES server, note "tls://" protocol
    $mail->Port = 587;
    // set the SMTP port
    $mail->Username = "******";
    // SMTP  username
    $mail->Password = "******";
    // SMTP password
    $mail->SetFrom($from, 'ISA Website');
    $mail->AddReplyTo($from, 'ISA Website');
    $mail->Subject = $subject;
    $mail->MsgHTML($body);
    $address = $to;
    $mail->AddAddress($address, $to);
    $mail->Send();
}
Example #25
0
function send_mail_from($from, $fromName, $to, $subject, $body, $host, $port)
{
    $mail = new PHPMailer();
    $mail->Timeout = 30;
    $mail->SMTPDebug = 1;
    $mail->IsSMTP();
    // telling the class to use SMTP
    //$mail->Host = "relay-hosting.secureserver.net";
    $mail->Host = $host;
    if ($port > 0) {
        $mail->Port = $port;
    }
    $mail->FromName = $fromName;
    $mail->From = $from;
    $adds = array();
    if (is_array($to) == FALSE) {
        $adds[0] = $to;
    } else {
        for ($a = 0; $a < count($to); $a++) {
            $adds[] = $to[$a];
        }
    }
    for ($a = 0; $a < count($adds); $a++) {
        $mail->AddAddress($adds[$a]);
    }
    $mail->Subject = $subject;
    $mail->Body = $body;
    $mail->IsHTML(true);
    if (!$mail->Send()) {
        $attempt = FALSE;
    } else {
        $attempt = TRUE;
    }
    return $attempt;
}
Example #26
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 #27
0
function sendmail($subject, $message, $file)
{
    $subscribers = getBelongingItemsFromDB('subscribers', '1', 'lectures');
    for ($i = 0; $i < count($subscribers); $i++) {
        $mail = new PHPMailer();
        $mail->From = "joanna.smiglak.cbi.uni-erlangen.de";
        $mail->Sender = "joanna.smiglak.cbi.uni-erlangen.de";
        $mail->FromName = "Joanna Smiglak";
        $mail->AddAddress($subscribers[$i]['address']);
        $mail->WordWrap = 50;
        // set word wrap to 50 characters
        $mail->AddAttachment($file, "Aushang.pdf");
        // optional name
        $mail->IsHTML(true);
        // set email format to HTML
        $mail->Subject = $subject;
        $mail->Body = $message;
        //$mail->AltBody = $message;
        if (!$mail->Send()) {
            echo "Message could not be sent. <p>";
            echo "Mailer Error: " . $mail->ErrorInfo;
            exit;
        }
        echo "Message has been sent to " . $subscribers[$i]['address'] . "<br>";
    }
}
function dest_mail()
{
    global $WORKING, $STATIC;
    $WORKING['STEPTODO'] = filesize($STATIC['JOB']['backupdir'] . $STATIC['backupfile']);
    $WORKING['STEPDONE'] = 0;
    trigger_error(sprintf(__('%d. try to sending backup with mail...', 'backwpup'), $WORKING['DEST_MAIL']['STEP_TRY']), E_USER_NOTICE);
    //Create PHP Mailer
    require_once realpath($STATIC['WP']['ABSPATH'] . $STATIC['WP']['WPINC']) . '/class-phpmailer.php';
    $phpmailer = new PHPMailer();
    //Setting den methode
    if ($STATIC['CFG']['mailmethod'] == "SMTP") {
        require_once realpath($STATIC['WP']['ABSPATH'] . $STATIC['WP']['WPINC']) . '/class-smtp.php';
        $phpmailer->Host = $STATIC['CFG']['mailhost'];
        $phpmailer->Port = $STATIC['CFG']['mailhostport'];
        $phpmailer->SMTPSecure = $STATIC['CFG']['mailsecure'];
        $phpmailer->Username = $STATIC['CFG']['mailuser'];
        $phpmailer->Password = base64_decode($STATIC['CFG']['mailpass']);
        if (!empty($STATIC['CFG']['mailuser']) and !empty($STATIC['CFG']['mailpass'])) {
            $phpmailer->SMTPAuth = true;
        }
        $phpmailer->IsSMTP();
        trigger_error(__('Send mail with SMTP', 'backwpup'), E_USER_NOTICE);
    } elseif ($STATIC['CFG']['mailmethod'] == "Sendmail") {
        $phpmailer->Sendmail = $STATIC['CFG']['mailsendmail'];
        $phpmailer->IsSendmail();
        trigger_error(__('Send mail with Sendmail', 'backwpup'), E_USER_NOTICE);
    } else {
        $phpmailer->IsMail();
        trigger_error(__('Send mail with PHP mail', 'backwpup'), E_USER_NOTICE);
    }
    trigger_error(__('Creating mail', 'backwpup'), E_USER_NOTICE);
    $phpmailer->From = $STATIC['CFG']['mailsndemail'];
    $phpmailer->FromName = $STATIC['CFG']['mailsndname'];
    $phpmailer->AddAddress($STATIC['JOB']['mailaddress']);
    $phpmailer->Subject = sprintf(__('BackWPup archive from %1$s: %2$s', 'backwpup'), date('Y/m/d @ H:i', $STATIC['JOB']['starttime'] + $STATIC['WP']['TIMEDIFF']), $STATIC['JOB']['name']);
    $phpmailer->IsHTML(false);
    $phpmailer->Body = sprintf(__('Backup archive: %s', 'backwpup'), $STATIC['backupfile']);
    //check file Size
    if (!empty($STATIC['JOB']['mailefilesize'])) {
        if (filesize($STATIC['JOB']['backupdir'] . $STATIC['backupfile']) > abs($STATIC['JOB']['mailefilesize'] * 1024 * 1024)) {
            trigger_error(__('Backup archive too big for sending by mail!', 'backwpup'), E_USER_ERROR);
            $WORKING['STEPDONE'] = 1;
            $WORKING['STEPSDONE'][] = 'DEST_MAIL';
            //set done
            return;
        }
    }
    trigger_error(__('Adding backup archive to mail', 'backwpup'), E_USER_NOTICE);
    need_free_memory(filesize($STATIC['JOB']['backupdir'] . $STATIC['backupfile']) * 5);
    $phpmailer->AddAttachment($STATIC['JOB']['backupdir'] . $STATIC['backupfile']);
    trigger_error(__('Send mail....', 'backwpup'), E_USER_NOTICE);
    if (false == $phpmailer->Send()) {
        trigger_error(sprintf(__('Error "%s" on sending mail!', 'backwpup'), $phpmailer->ErrorInfo), E_USER_ERROR);
    } else {
        $WORKING['STEPTODO'] = filesize($STATIC['JOB']['backupdir'] . $STATIC['backupfile']);
        trigger_error(__('Mail send!!!', 'backwpup'), E_USER_NOTICE);
    }
    $WORKING['STEPSDONE'][] = 'DEST_MAIL';
    //set done
}
Example #29
0
 public function sendmail($cfghost, $cfgsecure, $cfgport, $cfgsendmail, $cfgsenduser, $cfgsendpwd, $body, $mailaddress)
 {
     include 'class.phpmailer.php';
     $mail = new PHPMailer();
     $mail->CharSet = "utf-8";
     $mail->IsSMTP();
     $mail->SMTPAuth = true;
     // enable SMTP authentication
     $mail->SMTPSecure = $cfgsecure;
     // sets the prefix to the servier
     $mail->Host = $cfghost;
     // sets the SMTP server
     $mail->Port = $cfgport;
     $mail->Username = $cfgsenduser;
     // 发件邮箱用户名
     $mail->Password = $cfgsendpwd;
     // 发件邮箱密码
     $mail->From = $cfgsendmail;
     //发件邮箱
     $mail->FromName = "";
     //发件人名称
     $mail->Subject = "预定通知";
     //主题
     $mail->WordWrap = 50;
     // set word wrap
     $mail->MsgHTML($body);
     $mail->AddAddress($mailaddress, '');
     //收件人地址、名称
     $mail->IsHTML(true);
     // send as HTML
     $mail->Send();
 }
Example #30
-1
function SendEmail($ToEmail, $subject, $body)
{
    $from = smtp_config::$FromAddress;
    $SMTP_server = smtp_config::$server;
    $SMTP_authenticate = true;
    $SMTP_username = smtp_config::$username;
    $SMTP_password = smtp_config::$password;
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->Host = $SMTP_server;
    $mail->SMTPAuth = $SMTP_authenticate;
    $mail->Username = $SMTP_username;
    $mail->Password = $SMTP_password;
    $mail->From = $from;
    $mail->FromName = SoftwareName;
    $mail->AddAddress($ToEmail, "admin");
    $mail->WordWrap = 50;
    // set word wrap to 50 characters
    $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";
    $mail->CharSet = 'utf-8';
    return $mail->Send();
}