How to use amazon smtp with phpmailer ?

    To use amazon smtp in php using php mailer follow the steps below. Also download full phpmailer so that you have class.phpmailer.php and class.smtp.php
    <?php
    //Dowload phpmailer and include that first
    require_once('class.phpmailer.php');

    //Then do SMTP settings for it
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPAuth   = true; // SMTP Authentication true
    $mail->SMTPSecure = "tls"; // SMTP secure tls it will use its default port
    $mail->Host       = ""; // Amazon Hostname will be email-smtp.us-east-1.amazonaws.com
    $mail->Username   = ""; // Amazon SMTP Username
    $mail->Password   = ""// Amazon SMTP Password

    $mail->SetFrom('amazon@verifiedemail.com', 'Site Name or Sender Name'); // This is verified email otherwise it will not work
    $mail->Subject = ""; // Subject Here
    $body = ""; // Email Body Here
    $body = eregi_replace("[]",'',$body);
    $mail->MsgHTML($body);
    //Multiple or single recipient
    $mail->AddAddress("rajeev@mohitsharma.net", "Rajeev Singh");
    $mail->AddAddress("yashwant@mohitsharma.net", "Yashwant Singh");
    if (
    $mail->Send()) {
        echo
    "Your message sent";
    }
    else if(!
    $mail->Send()) {
        echo 
    $mail->ErrorInfo;
    }
    ?>
    5
    Average: 5 (1 vote)