miniproj Posted June 15, 2011 Share Posted June 15, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/239433-must-issue-a-starttls-command-first-configuring-smtp-on-php/ Share on other sites More sharing options...
trq Posted June 15, 2011 Share Posted June 15, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/239433-must-issue-a-starttls-command-first-configuring-smtp-on-php/#findComment-1230196 Share on other sites More sharing options...
miniproj Posted June 16, 2011 Author Share Posted June 16, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/239433-must-issue-a-starttls-command-first-configuring-smtp-on-php/#findComment-1230298 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.