Jump to content

"Must issue a STARTTLS command first" : configuring smtp on php


Recommended Posts

im using Xampp and i've been trying to send mail in php code using sendmail using a gmail account. it returns me this error

Must issue a STARTTLS command first. p5sm284921pbk.52<EOL>

 

ive made the required changes.....int the php.ini file and sendmail.ini .......the port im using is 587 .....

 

im a newbie so i wud appreciate all the help i can get .....

Thanx in advance

As I said in your other thread. PHP's mail() function does not support authentication, hence, you will not be able to use it with gmail.

 

It is designed to work with local servers.

 

You will need to use a third party library like PHPMailer, or install a sendmail emulator such as ssmtp.

i downloaded PHPmailer...but that isnt working well either.....its showing the error in IsSMTP() function. heres the code i found

 

require("phpmailer/class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP(); // send via SMTP

IsSMTP(); // send via SMTP

$mail->SMTPAuth = true; // turn on SMTP authentication

$mail->Username = "username@gmail.com"; // SMTP username

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

$webmaster_email = "username@doamin.com"; //Reply to this email ID

$email="username@domain.com"; // Recipients email ID

$name="name"; // Recipient's name

$mail->From = $webmaster_email;

$mail->FromName = "Webmaster";

$mail->AddAddress($email,$name);

$mail->AddReplyTo($webmaster_email,"Webmaster");

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

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

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

$mail->IsHTML(true); // send as HTML

$mail->Subject = "This is the subject";

$mail->Body = "Hi,

This is the HTML BODY "; //HTML Body

$mail->AltBody = "This is the body when user views in plain text format"; //Text Body

if(!$mail->Send())

{

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

}

else

{

echo "Message has been sent";

}

?>

 

would any1 b so kind as to let me know the steps to make the phpmailer work?? plz

ThankQ

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.