PHP mail

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
javasac
Forum Newbie
Posts: 7
Joined: Thu Apr 03, 2008 7:10 pm

PHP mail

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: PHP mail

Post by requinix »

Gmail uses encryption.

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