Exemplo n.º 1
0
function sendMail1($sTo, $sFrom, $sSubject, $mMail)
{
    $mail = new PHPMailer1(true);
    $mail->IsMail();
    $mail->IsHTML(true);
    $mail->CharSet = "utf-8";
    try {
        $mail->AddReplyTo($sTo);
        $mail->AddAddress($sTo);
        $mail->SetFrom($sFrom);
        $mail->Subject = $sSubject;
        $mail->MsgHTML($mMail);
        $mail->Send();
    } catch (phpmailerException $e) {
        $sErrorMsg = $e->errorMessage();
    } catch (Exception $e) {
        $sErrorMsg .= $e->getMessage();
    }
    return true;
}
Exemplo n.º 2
0
 // telling the class to use SMTP
 $mail->Host = "lindero.ru";
 // SMTP server
 $mail->SMTPDebug = 2;
 // enables SMTP debug information (for testing)
 // 1 = errors and messages
 // 2 = messages only
 $mail->SMTPAuth = true;
 // enable SMTP authentication
 $mail->Host = "lindero.ru";
 // sets the SMTP server
 $mail->Username = "******";
 // SMTP account username
 $mail->Password = "******";
 // SMTP account password
 $mail->SetFrom('*****@*****.**', 'First Last');
 $mail->AddReplyTo("*****@*****.**", "First Last");
 $mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication";
 $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
 // optional, comment out and test
 $mail->MsgHTML($body);
 $address = "*****@*****.**";
 $mail->AddAddress($address, "John Doe");
 $mail->AddAttachment("images/phpmailer.gif");
 // attachment
 $mail->AddAttachment("images/phpmailer_mini.gif");
 // attachment
 if (!$mail->Send()) {
     echo "Mailer Error: " . $mail->ErrorInfo;
 } else {
     echo "Message sent!";