Php mailer working problem

Dear sir…
Please inform me that I can use phpmailer with gmail SMTP on a free account…immediate reply will be highly appreciated

Yes, you can use phpmail with gmail SMTP

But when I add php mailer into the page…it’s perfectly working fine in the local server…but when I upload to server…the page containing the code didn’t show it’s self

What page are you referring to?

Can you access it by removing https and trying http if it initially shows https?

It’s not working…but the same code perfectly work in local hostil…iam using phpmailer

can you show us the code, so we could assist you better?

<?php

require_once("mail/class.PHPMailer.php");

 

function reg($email,$rand)

{             

$mail = new PHPMailer();

 

//$mail->IsSMTP();                                      // set mailer to use SMTP

$mail->SMTPDebug = 0;  // debugging: 1 = errors and messages, 2 = messages only

                $mail->SMTPAuth = true;  // authentication enabled

                $mail->SMTPSecure = 'TLS'; // secure transfer enabled REQUIRED for GMail

                $mail->Host = 'smtp.gmail.com';

                $mail->Port = 25;      // turn on SMTP authentication

$mail->Username = "abdulsatharpss";  // SMTP username

$mail->Password = "#######"; // SMTP password

 

$mail->From = "abdulsatharpss@gmail.com";

$mail->FromName = "Palakkad Pravasi Peoples Forum";

$mail->AddAddress($email);

/*$mail->AddAddress("ellen@example.com");    */              // name is optional

$mail->AddReplyTo("abdulsatharpss@gmail.com", "Information");

 

/*$mail->WordWrap = 50;                                 // set word wrap to 50 characters

$mail->AddAttachment("/var/tmp/file.tar.gz");         // add attachments

$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); */   // optional name

$mail->IsHTML(true);                                  // set email format to HTML

$message = '<html><body>';

$message.='<div style="width:550px; background-color:#CC6600; padding:15px; font-weight:bold;">';

$message.='Confirm your registration with us';

$message.='</div>';

$message.='<div style="font-family: Arial;">Thanks for joining with us.<br/>';

$message.='click on the below link in your verification mail id to verify your account ';

$message.="<a href='http://localhost/user-confirmation.php?email=$email&confirmation_code=$rand'>click</a>";

$message.='</div>';

$message.='</body></html>';

 

$mail->Subject = "Regsitration confirmation";

$mail->Body    = $message;

$mail->AltBody = "This is the body in plain text for non-HTML mail clients";

 

if(!$mail->Send())

{

   echo "Message could not be sent. <p>";

   echo "Mailer Error: " . $mail->ErrorInfo;

   exit;

}

 

$msg="Confirmation msg hase send to ur mail id.";

return $msg;

}

?>

Your port seems wrong for SMTP although I could be wrong?

Before I checked all the port’s …not working

Is there any option to enable SMTP mail sending ini php

It will be enabled what errors do you get?

No error msgs…
The same code used in local host…on server it shows blank page…

So the script doesn’t even come up at all?
Which page is this hosted at?

https://pppf.000webhostapp.com/register.php

So is that the error you get 500? Or does the page sometimes load or what?

With the php mailer code …it will not work…if i remove that code. The other parts works…
With the mail code the page does not show anything

What does it look like on localhost when you load it?

Can you zip it and upload to your site and link it here just so I can load onto my free hosting and premium to see if it appears?

1 Like

Any update sir???please help me

I tried it both on free and premium and both encountered 500 error I have not yet investigated the cause at the moment but I have a working sendmail script on both free and premium so would suggest the issue is with the code obviously.

Can u upload the working code ???

[code]<?php
//if “email” variable is filled out, send email
if (isset($_REQUEST[‘email’])) {

//Email information
$admin_email = "someone@example.com";
$email = $_REQUEST[‘email’];
$subject = $_REQUEST[‘subject’];
$comment = $_REQUEST[‘comment’];

//send email
mail($admin_email, “$subject”, $comment, “From:” . $email);

//Email response
echo “Thank you for contacting us!”;
}

//if “email” variable is not filled out, display the form
else {
?>

Email:
Subject:
Message:

<?php } ?>[/code]