Send mail with PHPMailer on iPage

Viewed 51

I have trouble sending emails from my iPage webserver. Firstly I watched a tutorial on how to use PHPMailer and the guy used gmail smpt server. That method worked flawlessly on localhost, but it doesn't work on the webserver and I cant find a solution for this anywhere. Seems like the authentication didn't work because I've got an email from google security saying someone was trying to log in to my gmail (it was 100% ipage), even accepting the new login doesn't work If there is a possibility I'd like to send mail from my custom domain email rather than form 3rd party gmail.

    require 'phpmailer/PHPMailer.php';
    require 'phpmailer/SMTP.php';
    require 'phpmailer/Exception.php';
    use PHPMailer\PHPMailer\PHPMailer;
    use PHPMailer\PHPMailer\SMTP;
    use PHPMailer\PHPMailer\Exception;
    $mail = new PHPMailer();
    $mail->isSMTP();
    $mail->Host = "smtp.gmail.com";
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = "tls";
    $mail->Port = "587";
    $mail->Username = ".....@gmail.com";
    $mail->Password = ".....";
    $mail->Subject = ".....";
    $mail->setFrom('.....@gmail.com');
    $mail->isHTML(true);
    $mail->Body = ".....";
    $mail->addAddress('.....@....');
    if ($mail->send()) echo "OK";
    else echo "BAD";
    $mail->smtpClose();
0 Answers
Related