1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Cant able to send message by SMTP to other email user like gmail yahoo

Discussion in 'Plesk 9.x for Windows Issue, Fixes, How-To' started by RajeshD, Mar 16, 2010.

  1. RajeshD

    RajeshD Guest

    I am trying to send email threw SMTP by phpmailer class but cant able to send email how to solve this problem ? Is there any setting I have to do on PLESK to enable SMTP authorization

    PHP file code

    $mail = new PHPMailer();

    $mail->IsSMTP(); // set mailer to use SMTP
    $mail->Host = "smtp1.example.com;smtp2.example.com"; // specify main and backup server
    $mail->SMTPAuth = true; // turn on SMTP authentication
    $mail->Username = "jswan"; // SMTP username
    $mail->Password = "secret"; // SMTP password

    $mail->From = "from@example.com";
    $mail->FromName = "Mailer";
    $mail->AddAddress("josh@example.net", "Josh Adams");
    $mail->AddAddress("ellen@example.com"); // name is optional
    $mail->AddReplyTo("info@example.com", "Information");

    $mail->WordWrap = 50; // set word wrap to 50 characters
    $mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments
    $mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
    $mail->IsHTML(true); // set email format to HTML

    $mail->Subject = "Here is the subject";
    $mail->Body = "This is the HTML message body <b>in bold!</b>";
    $mail->AltBody = "This is the body in plain text for non-HTML mail clients";

    echo "Message could not be sent. <p>";
    echo "Mailer Error: " . $mail->ErrorInfo;

    echo "Message has been sent";