Esempio n. 1
2
 function sendMail($props)
 {
     $mail = new PHPMailerLite();
     // defaults to using php "Sendmail" (or Qmail, depending on availability)
     $mail->IsMail();
     // telling the class to use native PHP mail()
     try {
         $mail->SetFrom('*****@*****.**', 'Adei User');
         $mail->AddAddress($props['email'], 'User');
         $mail->Subject = 'Adei Graph';
         $mail->MsgHTML($props['message']);
         $mail->AddAttachment($props['attachement']);
         // attachment
         $mail->Send();
         return $props['message'];
     } catch (phpmailerException $e) {
         return 'phpmailerException';
         //$e->errorMessage(); //Pretty error messages from PHPMailer
     } catch (Exception $e) {
         return 'exception';
         //$e->getMessage();//Boring error messages from anything else!
     }
 }
Esempio n. 2
0
 function recuperar() {
     $usu = $this->usuMP->findByUser($_POST["user"]);
     if($usu!=null) {
         include_once '../modelo/class.phpmailer-lite.php';
         $nomFrom = "Mantenedor RSPro.cl";
         $mail = new PHPMailerLite();
         $mail->IsMail();
         $mail->SetFrom("*****@*****.**", $nomFrom);
         $mail->Subject = "Recuperar Clave - $nomFrom";
         $mail->AddAddress($usu->EMAIL_USUARIO, $nomFrom);
         $pass = $this->genPass();
         $body = "El usuario es <b>".$usu->USER_USUARIO."</b> y su nueva contraseña <b>".$pass."</b><br><br>
             - $nomFrom";
         $mail->MsgHTML($body);
         $success = $mail->Send();
         if($success) {
             $this->usuMP->updatePass($usu->ID_USUARIO, $pass);
             $this->cp->getSession()->salto("?sec=log&e=2");
         } else {
             $this->cp->getSession()->salto("?sec=log&op=rec&e=2");
         }
     } else {
         $this->cp->getSession()->salto("?sec=log&op=rec&e=1");
     }
 }
<html>
<head>
<title>PHPMailer - Mail() advanced test</title>
</head>
<body>

<?php 
require_once '../class.phpmailer-lite.php';
$mail = new PHPMailerLite();
// defaults to using php "Sendmail" (or Qmail, depending on availability)
$mail->IsMail();
// telling the class to use native PHP mail()
try {
    $mail->SetFrom('*****@*****.**', 'First Last');
    $mail->AddAddress('*****@*****.**', 'John Doe');
    $mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
    $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
    // optional - MsgHTML will create an alternate automatically
    $mail->MsgHTML(file_get_contents('contents.html'));
    $mail->AddAttachment('images/phpmailer.gif');
    // attachment
    $mail->AddAttachment('images/phpmailer_mini.gif');
    // attachment
    $mail->Send();
    echo "Message Sent OK</p>\n";
} catch (phpmailerException $e) {
    echo $e->errorMessage();
    //Pretty error messages from PHPMailer
} catch (Exception $e) {
    echo $e->getMessage();
    //Boring error messages from anything else!
Esempio n. 4
0
function html_email($to, $subject, $msg)
{
    if (!TEST_MODE) {
        require_once 'class.phpmailer-lite.php';
        $mail = new PHPMailerLite();
        // defaults to using php "Sendmail" (or Qmail, depending on availability)
        $mail->IsMail();
        // telling the class to use native PHP mail()
        //$mail->CharSet	  = MY_CHARSET;
        $mail->Encoding = 'base64';
        $mail->IsHTML(true);
        $body = $msg;
        //convert to base 64
        $mail->MsgHTML($body);
        $body = rtrim(chunk_split(base64_encode($body)));
        $mail->SetFrom(FROM_EMAIL, FROM_NAME);
        $address = $to;
        $mail->AddAddress($address, "");
        $mail->Subject = $subject;
        if (!$mail->Send()) {
            echo 'The mail to ' . $to . ' failed to send.<br />';
        } else {
            echo 'The mail was sent successfully to ' . $to . '.<br />';
        }
    } else {
        echo '<b>Report running in test mode.</b><br />Disable test mode in the config.php when you are ready for the report to go live.<br /><br />';
        echo '<br />' . $msg . '<br />';
    }
}
    //        echo "Erro: " . $mail->ErrorInfo;
} else {
    //        echo "A mensagem foi enviada";
}
// Limpa os destinatários e os anexos
$Email->ClearAllRecipients();
$Email->ClearAttachments();
// Mensagem HTML de email avisando o Leonardo e outros emails
$subject = $emp['empreendimento'] . " - Solicitação de informação";
$message = "<table cellpadding='0' cellspacing='0' border='0' bgcolor='#FFFFFF' width='400' align='center'><tr><td align='center'><SPAN style=\"FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana\">" . $subject . ":</span><p></td></tr><tr><td><HR style='WIDTH: 375pt' align='center' width='500' color='#333333' noShade SIZE='1'></td></tr><tr><td valign='top' align='left'><SPAN style=\"FONT-WEIGHT: bold; FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana\">\n                        Data de envio: </span><SPAN style=\"FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana\">" . date('d/m/Y') . " às " . date('H:i:s') . " </span></td></tr><tr><td><HR style='WIDTH: 375pt' align=center width=500 color=#333333 noShade SIZE=1></td></tr><tr><td valign='top' align='left'><SPAN style=\"FONT-WEIGHT: bold; FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana\">\n                        Empreendimento: </span><SPAN style=\"FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana\">" . $nomeEmp . "</span></td></tr><tr><td><HR style='WIDTH: 375pt' align=center width=500 color=#333333 noShade SIZE=1></td></tr><tr><td valign='top' align='left'><SPAN style=\"FONT-WEIGHT: bold; FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana\">\n                        Nome: </span><SPAN style=\"FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana\">" . utf8_encode($nome) . "</span></td></tr><tr><td><HR style='WIDTH: 375pt' align=center width=500 color=#333333 noShade SIZE=1></td></tr><tr><td valign='top' align='left'><SPAN style=\"FONT-WEIGHT: bold; FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana\">\n                        Email: </span><SPAN style=\"FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana\">" . $email_address . "</span></td></tr><tr><td><HR style='WIDTH: 375pt' align=center width=500 color=#333333 noShade SIZE=1></td></tr><tr><td valign='top' align='left'><SPAN style=\"FONT-WEIGHT: bold; FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana\">\n                        Telefone: </span><SPAN style=\"FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana\">" . $phone . "</span></td></tr><tr><td><HR style='WIDTH: 375pt' align=center width=500 color=#333333 noShade SIZE=1></td></tr><tr><td valign='top' align='left'><SPAN style=\"FONT-WEIGHT: bold; FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana\">\n                        Mensagem: </span><SPAN style=\"FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana\">" . utf8_encode($msg) . "</span></td></tr><tr><td><HR style='WIDTH: 375pt' align=center width=500 color=#333333 noShade SIZE=1></td></tr></table>";
# faço a chamada da classe
$Email = new PHPMailerLite();
# na classe, há a opção de idioma, setei como br
$Email->SetLanguage("br");
# Esta chamada diz que o envio será feito através da função mail do php. Você mudar para sendmail, qmail, etc
$Email->IsMail(true);
# Ativa o envio de e-mails em HTML, se false, desativa.
$Email->IsHTML(true);
# Email do remetente da mensagem
$Email->From = '*****@*****.**';
# Nome do remetente do email
$Email->FromName = utf8_decode('Só Vantagem Imóveis');
# Endereço de destino do email, ou seja, pra onde você quer que a mensagem do formulário vá?
$Email->AddAddress('*****@*****.**');
$emails = explode(";", $emp['emails']);
foreach ($emails as $e) {
    $e = trim($e);
    if ($e != '*****@*****.**') {
        $Email->AddBcc($e);
    }
}
Esempio n. 6
0
function enviar_correo_recover($usr_email, $new_pwd)
{
    global $globals;
    require_once 'class.phpmailer-lite.php';
    $mail = new PHPMailerLite();
    $mail->From = 'auto-reply@' . $globals['host'];
    $mail->FromName = $globals['nombrewebsite'];
    $mail->CharSet = "utf-8";
    $mail->IsMail();
    // telling the class to use native PHP mail()
    $message = "¡Hola!<br><br>\n\nHas pedido recuperar tu contraseña. Apunta tu nueva clave y úsala a partir de ahora para ingresar en la web:<br><br>\n\n{$new_pwd}<br><br>\n\nPor seguridad es recomendable que una vez conectado la cambies manualmente desde tu perfil. PENDIENTE: poner enlace.<br><br>\n\nAtentamente,<br>\nEl equipo de {$globals['nombrewebsite']}<br>\n______________________________________________________<br>\nESTE ES UN MENSAJE GENERADO AUTOMÁTICAMENTE<br>\n****NO RESPONDA A ESTE CORREO****<br>\n";
    try {
        $mail->AddReplyTo('auto-reply@' . $globals['host'], $globals['nombrewebsite']);
        $mail->AddAddress($usr_email);
        $mail->Subject = 'Recuperación de la contraseña';
        $mail->MsgHTML($message);
        $mail->isHtml(false);
        $mail->Send();
        return true;
    } catch (phpmailerException $e) {
        return false;
    } catch (Exception $e) {
        return false;
    }
}