Jump to content


This topic is now archived and is closed to further replies.


"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

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites

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



$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->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



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




echo "Message has been sent";




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


Share this post

Link to post
Share on other sites

  • 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.