Send mail using an email account created on Hostinger PHP

0 votes

I am using an email I created on the hpanel to send emails through PHPMailer.  The code is hosted on hostinger's hpanel and it didn't show any errors but it also didn't give any feedback if the mail is sent or not.

        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;
        }

Can someone help me in solving this?

Jun 7, 2022 in PHP by Kichu
• 19,040 points
3,884 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
1 answer

How to send email using php?

Hello @kartik 1.) Download PHPMailer, open the zip file ...READ MORE

answered Apr 1, 2020 in PHP by Niroj
• 82,840 points
1,387 views
0 votes
0 answers

Send email with PHP from html form on submit with the same script

When a user has finished filling out ...READ MORE

Jul 29, 2022 in PHP by Kithuzzz
• 38,000 points
1,169 views
0 votes
1 answer

How to check if a string is an email address in PHP?

Hello, Try this without regular expressions: <?php ...READ MORE

answered Nov 3, 2020 in PHP by Niroj
• 82,840 points
4,008 views
0 votes
0 answers

How to pop an alert message box using PHP?

How to pop an alert message box ...READ MORE

Jun 3, 2022 in PHP by Kichu
• 19,040 points
479 views
0 votes
0 answers

Edit PHP query code depending on image map clicked area using AJAX

I am working on an image map ...READ MORE

Jun 3, 2022 in PHP by Kichu
• 19,040 points
424 views
0 votes
0 answers

How to reverse an array in php WITHOUT using the array reverse method

I have an array called reverse array ...READ MORE

Jun 12, 2022 in PHP by narikkadan
• 63,600 points
2,226 views
0 votes
0 answers

PHPMailer: SMTP Error: Could not connect to SMTP host

I am having trouble sending mail through ...READ MORE

May 8, 2022 in PHP by Kichu
• 19,040 points
3,152 views
0 votes
0 answers

Mailer Error: SMTP connect() failed in php mailer( https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting)

Here is code for sending email from ...READ MORE

Jun 2, 2022 in PHP by Kichu
• 19,040 points
13,150 views
0 votes
0 answers

phpmailer error "Could not instantiate mail function"

I'm getting the error "Mailer Error: Could ...READ MORE

Jun 13, 2022 in PHP by narikkadan
• 63,600 points
2,454 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP