emailphpmailer

Send mail using an email account created on Hostinger (PHP)


I am sending an email through PHPMailer, the code is hosted on hostinger's hpanel and I am using an email I created on the hpanel. After running the code, I get no errors, and no feedback on whether the mail has been sent, it just doesn't show anything.

Please help me I currently don't know what to do.

        require '../../vendor/autoload.php';

        $mail = new PHPMailer(true);
        try
        {
            $mail->SMTPDebug = SMTP::DEBUG_SERVER;
            
            $mail->isSMTP();
            $mail->Host = 'smtp.titan.email';
            $mail->SMTPAuth = true;
            $mail->Username = 'admin@hostinger.com';
            $mail->Password = 'password';
            $mail->SMTPSecure = 'SSL';
            $mail->Port = 465;

            $mail->setFrom('admin@hostinger.com', 'Hostinger');
            $mail->addAddress($email, $username);
            $mail->addReplyTo('admin@hostinger.com', 'For any Information');
            $mail->addCC('admin@hostinger.com');
            
            $mail->isHTML(true);
            $mail->Subject = 'Sending message';
            $mail->Body    = $message;
            $mail->AltBody = "Hello there";

            $mail->send();

            echo "Sent";
        }
        catch (Exception $eax) 
        {
            echo 'EMAIL SENDING FAILED. INFO: '.$mail->ErrorInfo;
        }

Solution

  • No need to Use $mail->isSMTP();

    Comment $mail->isSMTP();