Page 1 of 1

PHP mail

Posted: Tue Mar 10, 2009 1:50 pm
by javasac
Hi All,

I am using the following code to send mail.

<?php
$Name = "xyz";
$email = "xyz@yahoo.com";
$recipient = "abc@hotmail.com"; //recipient
$mail_body = "The text for the mail..."; //mail body
$subject = "Subject for reviever"; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields

ini_set('sendmail_from', 'xyz@yahoo.com'); //Suggested by "Some Guy"

mail($recipient, $subject, $mail_body, $header); //mail command :)
?>

In php.ini the settings are...
SMTP = smtp.gmail.com
smtp_port = 25

I am getting this error.

Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. a14sm1913669tia.7 in D:\wamp\www\yojoe-web\html\site\mail.php on line 11

Please suggest a solution.

Thanks,
Sachin

Re: PHP mail

Posted: Tue Mar 10, 2009 2:17 pm
by requinix
Gmail uses encryption.

Use something like PHPMailer to send mail, it's much easier.