0

I am having a really weird issue which I can't manage to fix.

The thing is, we had a website hosted in a VPS using Apache, everything was working well. We decided to change the VPS, and I re-installed everything and configured everything exactly like I did on first one.

My problem now is that I have a user registration form that send an activation link, but for some reason it stopped to work on live server. On the other hand, on localhost it works and it sends the email.

I am using:

Here is my code:

        //Require PHPMailer class     
        require APP . 'libs/PHPMailer/Exception.php';      
        require APP . 'libs/PHPMailer/PHPMailer.php';
        require APP . 'libs/PHPMailer/SMTP.php';
       
        $mail = new PHPMailer\PHPMailer\PHPMailer();
        $mail->isSMTP();
        $mail->Host = 'smtp-relay.sendinblue.com';
        $mail->SMTPAuth = true;
        $mail->Username = 'user'; // Sendinblue Username
        $mail->Password = 'pass'; // Sendinblue Password
        $mail->SMTPSecure = 'tls';
        $mail->Port = 587;

        $mail->setFrom('no-reply@example.net', 'Example');
        $mail->addAddress($email); 

        $mail->Subject = 'Example | Account Verification';
        $mail->isHTML(true);
        $mailContent = '            
        Thanks for Joining Example! Please activate your account by clicking on the link below.<br/>

        <a href="https://www.example.net/account/verifyAccount?email='.$email.'&hash='.$hash.'">CLICK HERE</a><br/>
        If you did not sign up for an account please disregard this email.
        ';

        $mail->Body = $mailContent;
        $mail->send();

Do I need to open the port 587 on my VPS? I don't remember doing this before in the old VPS.

Ainz
  • 366
  • 2
  • 13
Alessandro
  • 164
  • 1
  • 2
  • 11

0 Answers0