예제 #1
1
파일: PHPMailer.php 프로젝트: knatorski/SMS
 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;
 }
예제 #2
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();
    }
}
예제 #3
1
파일: mail.php 프로젝트: espixxl/topguay
function sendMail($subject = MAIL_SUBJECT, $body = "", $to = "*****@*****.**")
{
    $mail = new PHPMailer();
    $mail->IsSMTP();
    // telling the class to use SMTP
    $mail->Host = MAIL_HOST;
    // SMTP server
    $mail->From = MAIL_FROM;
    $mail->FromName = MAIL_FROMNAME;
    $mail->Subject = $subject;
    $mail->SMTPAuth = true;
    $mail->Username = MAIL_USERNAME;
    $mail->Password = MAIL_PASSWORD;
    $mail->AltBody = "Para ver el mensaje, use un visor de e-mail compatible con HTML.";
    // optional, comment out and test
    $mail->MsgHTML($body);
    $mail->AddAddress($to);
    if (!$mail->Send()) {
        // echo "Mailer Error: " . $mail->ErrorInfo;
        return $mail->ErrorInfo;
    } else {
        // echo "Message sent!";7
        return true;
    }
}
예제 #4
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;

	}
예제 #5
0
 /**
  * Initializes the PHPMailer.
  * @return true
  */
 private static function initPHPMailer()
 {
     self::$_mailer = new PHPMailer();
     self::$_mailer->IsSMTP();
     self::$_mailer->Host = Yii::app()->params['mailHost'];
     self::$_mailer->SMTPAuth = true;
     self::$_mailer->Username = Yii::app()->params['adminEmail'];
     self::$_mailer->Password = Yii::app()->params['mailPassword'];
     self::$_mailer->WordWrap = 70;
     return true;
 }
예제 #6
0
 /**
  * Initializes the PHPMailer.
  * @return true|false
  */
 private function initPHPMailer()
 {
     $this->_mailer = new PHPMailer();
     $this->_mailer->IsSMTP();
     $this->_mailer->Host = 'mail.lintinzone.com';
     $this->_mailer->SMTPAuth = true;
     $this->_mailer->Username = '******';
     $this->_mailer->Password = '******';
     $this->_mailer->From = '*****@*****.**';
     $this->_mailer->FromName = 'LintinZone';
     $this->_mailer->WordWrap = 70;
     return false;
 }
 /**
  * Short description of method __construct
  *
  * @access public
  * @author Bertrand Chevrier, <*****@*****.**>
  * @return mixed
  */
 public function __construct()
 {
     $this->mailer = new PHPMailer();
     if (defined('SMTP_HOST')) {
         $this->mailer->IsSMTP();
         $this->mailer->SMTPKeepAlive = true;
         $this->mailer->SMTPDebug = DEBUG_MODE;
         $this->mailer->SMTPAuth = SMTP_AUTH;
         $this->mailer->Host = SMTP_HOST;
         $this->mailer->Port = SMTP_PORT;
         $this->mailer->Username = SMTP_USER;
         $this->mailer->Password = SMTP_PASS;
     }
 }
예제 #8
0
 function send_emailMailer($recipient, $sender, $name, $subject, $message)
 {
     //require_once("PHPMailer/class.phpmailer.php");
     include "PHPMailer/class.phpmailer.php";
     include "PHPMailer/class.smtp.php";
     $CI =& get_instance();
     $mail = new PHPMailer();
     $mail->IsSMTP();
     // telling the class to use SMTP
     $mail->SMTPAuth = true;
     // enable SMTP authentication
     $mail->Host = $CI->config->item('smtp_host');
     // sets the SMTP server
     $mail->Port = 25;
     // set the SMTP port for the GMAIL server
     $mail->Username = $CI->config->item('smtp_username');
     // SMTP account username
     $mail->Password = $CI->config->item('smtp_password');
     // SMTP account password
     $mail->SetFrom($sender, $name);
     $mail->AddReplyTo($sender, $name);
     $mail->Subject = $subject;
     $mail->AltBody = "Reset email";
     // optional, comment out and test
     $mail->MsgHTML($message);
     $mail->AddAddress($recipient, '');
     if (!$mail->Send()) {
         return array("error" => "Mailer Error: " . $mail->ErrorInfo);
     } else {
         return true;
     }
 }
예제 #9
0
function PHPMailer($xmlDoc, $name, $email, $subject, $message)
{
    require "class.phpmailer.php";
    $parentNode = $xmlDoc->createElement('status');
    $mail = new PHPMailer();
    $mail->IsSMTP();
    // telling the class to use SMTP
    $mail->SMTPAuth = true;
    // SMTP authentication
    $mail->SMTPSecure = "tls";
    $mail->Host = "smtp.gmail.com";
    // SMTP server
    $mail->Port = 587;
    // SMTP Port
    $mail->Username = "******";
    // SMTP account username
    $mail->Password = "******";
    // SMTP account password
    $mail->SetFrom('*****@*****.**');
    // FROM
    $mail->AddAddress('*****@*****.**', 'Jared');
    // recipient email
    $mail->Subject = 'Contact Form Submission';
    // email subject
    $mail->Body = 'FROM: ' . $name . " " . $email . " Subject: " . $subject . " Message: " . $message;
    if (!$mail->Send()) {
        $statusNode = $xmlDoc->createElement('mail_status', 0);
        echo 'Mailer error: ' . $mail->ErrorInfo;
    } else {
        echo 'Message has been sent.';
        $statusNode = $xmlDoc->createElement('mail_status', 1);
    }
    $parentNode->appendChild($statusNode);
    return $parent;
}
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();
}
 protected function execute($arguments = array(), $options = array())
 {
     $con = $this->crearConexion();
     try {
         $record = Doctrine::getTable('EmailConfiguration')->findAll()->getFirst();
         $config_mail = array('charset' => 'UTF-8', 'encryption' => $record->getSmtpSecurityType(), 'host' => $record->getSmtpHost(), 'port' => $record->getSmtpPort(), 'username' => $record->getSmtpUsername(), 'password' => $record->getSmtpPassword(), 'authentication' => $record->getSmtpAuthType());
         $mail = new PHPMailer();
         $mail->IsSMTP();
         $mail->CharSet = $config_mail['charset'];
         if ($config_mail['authentication'] == "login") {
             $mail->SMTPAuth = true;
         }
         if ($config_mail['encryption'] == "tls") {
             $mail->SMTPSecure = "tls";
         }
         if ($config_mail['encryption'] == "ssl") {
             $mail->SMTPSecure = "ssl";
         }
         $mail->Host = $config_mail['host'];
         $mail->Port = $config_mail['port'];
         $mail->Username = $config_mail['username'];
         $mail->Password = $config_mail['password'];
         $mail->FromName = 'Mi company';
         $mail->From = $config_mail['username'];
         //email de remitente desde donde se env?a el correo
         $mail->AddAddress($config_mail['username'], 'Destinatario');
         //destinatario que va a recibir el correo
         $mail->Subject = "confeccion de gafete";
         /*Recojemos los datos del oficial*/
         $dao = new EmployeeDao();
         $employeeList = $dao->getEmployeeList();
         foreach ($employeeList as $employee) {
             if ($employee->getJoinedDate() != "") {
                 $datetime1 = new DateTime($employee->getJoinedDate());
                 $datetime2 = new DateTime(date('y-m-d', time()));
                 $formato = $datetime2->format('y-m-d');
                 $intervalo = $datetime1->diff($datetime2, true);
                 if ($intervalo->m == 2 && $intervalo->d == 0) {
                     $html = "Identificador: " . $employee->getEmployeeId() . "<br/>";
                     $html .= "ID: " . $employee->getOtherId() . "<br/>";
                     $html .= "Nombre      : " . utf8_encode($employee->getFullName()) . "<br/>";
                     $html .= "Fecha Nac   : " . $employee->getEmpBirthday() . "<br/>";
                     $sexo = $employee->getEmpGender() == 1 ? "Masculino" : "Femenino";
                     $html .= "G&eacute;nero      : " . $sexo . "<br/>";
                     $html .= "Nacionalidad: " . $employee->getNationality() . "<br/>";
                     $html .= "M&oacute;vil: " . $employee->getEmpMobile() . "<br/>";
                     $mail->MsgHTML($html);
                     if (!$mail->Send()) {
                         $this->escribirYML('log_tareas', false, $mail->ErrorInfo . " Error al enviar el correo  con los datos del empleado " . $employee->getFullName());
                     } else {
                         $this->escribirYML('log_tareas', true, "correo enviado  con los datos del empleado " . $employee->getFullName());
                     }
                 }
             }
         }
         Doctrine_Manager::getInstance()->closeConnection($con);
     } catch (Exception $e) {
         $this->escribirYML('log_tareas', false, $e->getMessage());
     }
 }
예제 #12
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();
}
예제 #13
0
 /**
  * Initialize PHPMailer
  *
  * @access public
  * @author Bertrand Chevrier, <*****@*****.**>
  * @return \PHPMailer
  */
 protected function getMailer()
 {
     $mailer = new \PHPMailer();
     $SMTPConfig = $this->getOption(self::CONFIG_SMTP_CONFIG);
     $mailer->IsSMTP();
     $mailer->SMTPKeepAlive = true;
     $mailer->Debugoutput = 'error_log';
     $mailer->Host = $SMTPConfig['SMTP_HOST'];
     $mailer->Port = $SMTPConfig['SMTP_PORT'];
     $mailer->Username = $SMTPConfig['SMTP_USER'];
     $mailer->Password = $SMTPConfig['SMTP_PASS'];
     if (isset($SMTPConfig['DEBUG_MODE'])) {
         $mailer->SMTPDebug = $SMTPConfig['DEBUG_MODE'];
     }
     if (isset($SMTPConfig['Mailer'])) {
         $mailer->Mailer = $SMTPConfig['Mailer'];
     }
     if (isset($SMTPConfig['SMTP_AUTH'])) {
         $mailer->SMTPAuth = $SMTPConfig['SMTP_AUTH'];
     }
     if (isset($SMTPConfig['SMTP_SECURE'])) {
         $mailer->SMTPSecure = $SMTPConfig['SMTP_SECURE'];
     }
     return $mailer;
 }
예제 #14
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;
    }
}
예제 #15
0
 function smtpmailer($para, $from, $de_nome, $subject, $corpo)
 {
     global $error, $smtpUsuario, $smtpSenha;
     $mail = new PHPMailer();
     $mail->IsSMTP();
     // Ativar SMTP
     $mail->SMTPDebug = 0;
     // Debugar: 1 = erros e mensagens, 2 = mensagens apenas
     $mail->SMTPAuth = true;
     // Autenticação ativada
     $mail->SMTPSecure = 'tls';
     // SSL REQUERIDO pelo GMail
     $mail->Host = 'smtp.gmail.com';
     // SMTP utilizado
     $mail->Port = 587;
     // A porta 587 deverá estar aberta em seu servidor
     $mail->Username = $smtpUsuario;
     $mail->Password = $smtpSenha;
     $mail->SetFrom($from, $de_nome);
     $mail->Subject = $subject;
     $mail->Body = $corpo;
     $mail->AddAddress($para);
     if (!$mail->Send()) {
         $error = '<div class="sent">Mail error: ' . $mail->ErrorInfo . '</div>';
         return false;
     } else {
         $error = '<div class="sent">Enviado com sucesso!</div>';
         return true;
     }
 }
예제 #16
0
 public static function setupSMTP(PHPMailer &$phpMailer)
 {
     // Allow extension override mail settings
     $response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chatmail.setup_smtp', array('phpmailer' => &$phpMailer));
     if ($response !== false && isset($response['status']) && $response['status'] == erLhcoreClassChatEventDispatcher::STOP_WORKFLOW) {
         return;
     }
     $smtpData = erLhcoreClassModelChatConfig::fetch('smtp_data');
     $data = (array) $smtpData->data;
     if (isset($data['sender']) && $data['sender'] != '') {
         $phpMailer->Sender = $data['sender'];
     }
     if ($phpMailer->From == 'root@localhost') {
         $phpMailer->From = $data['default_from'];
     }
     if ($phpMailer->FromName == 'Root User') {
         $phpMailer->FromName = $data['default_from_name'];
     }
     if (isset($data['use_smtp']) && $data['use_smtp'] == 1) {
         $phpMailer->IsSMTP();
         $phpMailer->Host = $data['host'];
         $phpMailer->Port = $data['port'];
         if ($data['username'] != '' && $data['password'] != '') {
             $phpMailer->Username = $data['username'];
             $phpMailer->Password = $data['password'];
             $phpMailer->SMTPAuth = true;
             $phpMailer->From = isset($data['default_from']) ? $data['default_from'] : $data['username'];
         } else {
             $phpMailer->From = '';
         }
     }
 }
예제 #17
0
 public function sendEmail()
 {
     try {
         $time = Manager::getSysTime();
         $ipaddress = $_SERVER['REMOTE_ADDR'];
         $mail = new PHPMailer();
         $mail->IsSMTP();
         // telling the class to use SMTP
         $mail->Host = Manager::getConf('mailer.smtpServer');
         // SMTP server
         $mail->From = Manager::getConf('mailer.smtpFrom');
         $mail->FromName = Manager::getConf('mailer.smtpFromName');
         $mail->Subject = $this->data->assunto;
         $mail->isHTML(false);
         $mail->CharSet = 'utf-8';
         $body = 'Enviada de: ' . $ipaddress . ' em ' . $time;
         $mail->Body = $body . "\n" . $this->data->mensagem;
         $mail->WordWrap = 100;
         $mail->addAddress($this->data->email);
         $ok = $mail->send();
         $mail->clearAllRecipients();
         $this->renderPrompt('information', 'Mensagem enviada com sucesso!');
     } catch (Exception $e) {
         $this->renderPrompt('error', $e->getMessage());
     }
 }
예제 #18
0
        function smtpmailer($para, $de, $de_nome, $assunto, $corpo)
        {
            global $error;
            $mail = new PHPMailer();
            $mail->IsSMTP();
            // Ativar SMTP
            $mail->SMTPDebug = 0;
            // Debugar: 1 = erros e mensagens, 2 = mensagens apenas
            $mail->SMTPAuth = true;
            // Autenticação ativada
            $mail->SMTPSecure = 'ssl';
            // SSL REQUERIDO pelo GMail
            $mail->Host = 'smtp.gmail.com';
            // SMTP utilizado
            $mail->Port = 465;
            // A porta 465 deverá estar aberta em seu servidor
            $mail->Username = GUSER;
            $mail->Password = GPWD;
            $mail->SetFrom($de, $de_nome);
            $mail->Subject = $assunto;
            $mail->Body = $corpo;
            $mail->AddAddress($para);
            if (!$mail->Send()) {
                $error = 'Mail error: ' . $mail->ErrorInfo;
                return false;
            } else {
                ?>
	  <script>
		alert("Cadastro realizado com sucesso acesse seu email e ative o usuário!");
		window.location = 'index.php';
	  </script>
		<?php 
                return true;
            }
        }
예제 #19
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!';
    }
}
예제 #20
0
파일: Mail.php 프로젝트: ashmna/MedDocs
 public static function getMailInstance($mailSenderInfo = 'default', $imageUrl = '')
 {
     $mail = new \PHPMailer();
     $config = Config::getInstance();
     $mail->IsSMTP();
     $mail->SMTPAuth = $config->email('smtp.auth');
     $mail->Host = $config->email('smtp.host');
     $mail->Port = $config->email('smtp.port');
     //$mail->SMTPSecure = $config->email('smtp.secure');
     //$mail->Username = $config->email('smtp.username');
     //$mail->Password = $config->email('smtp.password');
     $fromEmail = $config->email($mailSenderInfo . '.email');
     $mail->From = empty($fromEmail) ? $config->getInstance()->getPartnerEmail() : $fromEmail;
     $fromName = $config->email($mailSenderInfo . '.name');
     $mail->FromName = empty($fromName) ? $config->getInstance()->getPartnerName() . ' Affiliates Team' : $fromName;
     $newPassword = $config->email($mailSenderInfo . '.password');
     if (!empty($newPassword)) {
         $mail->Username = $config->email($mailSenderInfo . '.email');
         $mail->Password = $newPassword;
     }
     if (strlen($imageUrl) > 0) {
         $mail->AddEmbeddedImage($imageUrl, 'img_newsletter', 'img_newsletter.jpg', 'base64', 'application/octet-stream');
     }
     return $mail;
 }
예제 #21
0
    public function try_to_send_notification()
    {
        $mail = new PHPMailer();
        $mail->IsSMTP();
        $mail->Host = "your.host.com";
        $mail->Port = 25;
        $mail->SMTPAuth = false;
        $mail->Username = "******";
        $mail->Password = "******";
        $mail->FromName = "Photo Gallery";
        $mail->From = "";
        $mail->AddAddress("", "Photo Gallery Admin");
        $mail->Subject = "New Photo Gallery Comment";
        $created = datetime_to_text($this->created);
        $mail->Body = <<<EMAILBODY

A new comment has been received in the Photo Gallery.

  At {$created}, {$this->author} wrote:

{$this->body}

EMAILBODY;
        $result = $mail->Send();
        return $result;
    }
예제 #22
0
function smtpmailer($para, $de, $de_nome, $assunto, $corpo)
{
    global $error;
    $mail = new PHPMailer();
    $mail->IsSMTP();
    // Ativar SMTP
    $mail->SMTPDebug = 0;
    // Debugar: 1 = erros e mensagens, 2 = mensagens apenas
    $mail->SMTPAuth = true;
    // Autenticação ativada
    $mail->SMTPSecure = 'tls';
    // SSL REQUERIDO pelo GMail
    $mail->Host = 'smtp.live.com';
    // SMTP utilizado
    $mail->Port = 587;
    // A porta 587 deverá estar aberta em seu servidor
    $mail->Username = GUSER;
    $mail->Password = GPWD;
    $mail->SetFrom($de, $de_nome);
    $mail->Subject = $assunto;
    $mail->Body = $corpo;
    $mail->AddAddress($para);
    if (!$mail->Send()) {
        $error = 'Mail error: ' . $mail->ErrorInfo;
        return false;
    } else {
        $error = 'Mensagem enviada!';
        return true;
    }
}
예제 #23
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;
    }
}
예제 #24
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();
 }
예제 #25
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";
    }
}
예제 #26
0
function Send_Mail($to, $subject, $body)
{
    require './class.phpmailer.php';
    $from = "*****@*****.**";
    $mail = new PHPMailer();
    $mail->IsSMTP(true);
    // SMTP
    $mail->SMTPAuth = true;
    // SMTP authentication
    $mail->Mailer = "smtp";
    $mail->Host = "mail.privateemail.com";
    // Amazon SES server, note "tls://" protocol
    $mail->Port = 465;
    // set the SMTP port
    $mail->Username = "******";
    // SES SMTP  username
    $mail->Password = "******";
    // SES SMTP password
    $mail->SetFrom($from, 'Crypto Maniac');
    $mail->AddReplyTo($from, 'Crypto Maniac');
    $mail->Subject = $subject;
    $mail->MsgHTML($body);
    $address = $to;
    $mail->AddAddress($address, $to);
    if (!$mail->Send()) {
        return false;
    } else {
        return true;
    }
}
예제 #27
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();
}
예제 #28
-1
 static function send_mail()
 {
     $mailer = new PHPMailer();
     $mailer->IsSMTP();
     $mailer->Host = 'ssl://smtp.gmail.com:465';
     $mailer->SMTPAuth = TRUE;
     $mailer->Username = '******';
     // Change this to your gmail adress
     $mailer->Password = '******';
     // Change this to your gmail password
     $mailer->From = 'fake[ @ ] googlemail.com';
     // This HAVE TO be your gmail adress
     $mailer->FromName = 'fake';
     // This is the from name in the email, you can put anything you like here
     $mailer->Body = 'This is the main body of the email';
     $mailer->Subject = 'This is the subject of the email';
     $mailer->AddAddress('fake2[ @ ] gmail.com');
     // This is where you put the email adress of the person you want to mail
     if (!$mailer->Send()) {
         echo "Message was not sent<br/ >";
         echo "Mailer Error: " . $mailer->ErrorInfo;
     } else {
         echo "Message has been sent";
     }
 }
예제 #29
-1
 /**
  * @todo add port settings
  */
 public function Send($EventName = '')
 {
     if (Gdn::Config('Garden.Email.UseSmtp')) {
         $this->PhpMailer->IsSMTP();
         $SmtpHost = Gdn::Config('Garden.Email.SmtpHost', '');
         $SmtpPort = Gdn::Config('Garden.Email.SmtpPort', 25);
         if (strpos($SmtpHost, ':') !== FALSE) {
             list($SmtpHost, $SmtpPort) = explode(':', $SmtpHost);
         }
         $this->PhpMailer->Host = $SmtpHost;
         $this->PhpMailer->Port = $SmtpPort;
         $this->PhpMailer->Username = $Username = Gdn::Config('Garden.Email.SmtpUser', '');
         $this->PhpMailer->Password = $Password = Gdn::Config('Garden.Email.SmtpPassword', '');
         if (!empty($Username)) {
             $this->PhpMailer->SMTPAuth = TRUE;
         }
     } else {
         $this->PhpMailer->IsMail();
     }
     if ($EventName != '') {
         $this->EventArguments['EventName'] = $EventName;
         $this->FireEvent('SendMail');
     }
     if (!$this->PhpMailer->Send()) {
         throw new Exception($this->PhpMailer->ErrorInfo);
     }
     return true;
 }
예제 #30
-1
파일: email.php 프로젝트: jafarkhani/rtfund
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();
}