What's new

Phpmailer not working on hosting site

IIZeroHourII

Eternal Poster
Joined
Mar 16, 2016
Posts
866
Reaction
315
Points
348
Pahelp po Working naman sa localhost nakakapag send ng email. pero pag inupload na sa hosting site. di na nag sesend ng email.

PHP:
if($count == 1) {
        $actual_link = "$_SERVER[HTTP_HOST]/php/verify_user_registration.php?student_number=$student_number&firstname=$firstname&middlename=$middlename&lastname=$lastname&suffix=$suffix&email=$newemail&verify_user_registration=";
        
        try {
            //Server settings
            $mail->isSMTP();                                            //Send using SMTP
            $mail->Host       = 'smtp.gmail.com';                     //Set the SMTP server to send through
            $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
            $mail->Username   = 'maynardhalili91@gmail.com';                     //SMTP username
            $mail->Password   = '*******';                               //SMTP password
            $mail->SMTPSecure = "tls";           //Enable implicit TLS encryption
            $mail->Port       = 587;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
        
            //Recipients
            $mail->setFrom('maynardhalili91@gmail.com');
            $mail->addAddress($email);     //Add a recipient
        
            //Content
            $mail->isHTML(true);                                  //Set email format to HTML
            $mail->Subject = 'Saint Jude Email Verification';
            $mail->Body    = 'Click this link to proceed in creating your account: '.$actual_link;
        
            $mail->send();

            $_SESSION['emailsent'] = "Check your email to Continue on registration";
            header("location: ../registration-student_1.php");
        } catch (Exception $e) {
            echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
        }
 
Hindi pwede or disabled ang functions ng PHP
PHP:
mail()
sa mga free hosting since included lang yun sa mga ρrémíùm packages nila. Same as
Perl:
/usr/lib/sendmail
using Perl script hindi rin pwede. Pwera nalang kung naka relay server ka pwede yun sa free hosting package nila.
 
sa pagkaka alam ko, bawal yan sa infinityfree, malakas kasi sa cpu kapag nagsesend ng email. bili ka ρrémíùm hosting.
 
Back
Top