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

Time:05-02

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 = '[email protected]';
            $mail->Password = 'password';
            $mail->SMTPSecure = 'SSL';
            $mail->Port = 465;

            $mail->setFrom('[email protected]', 'Hostinger');
            $mail->addAddress($email, $username);
            $mail->addReplyTo('[email protected]', 'For any Information');
            $mail->addCC('[email protected]');
            
            $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;
        }

CodePudding user response:

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

Comment $mail->isSMTP();

  • Related