Tech blog

PHP tutorials,a way to getting some thing new in web

Followers

Powered by Blogger.
Showing posts with label mail. Show all posts
Showing posts with label mail. Show all posts

Wednesday, 24 September 2014

How to send email using php?

No comments :
$subject="Hi How are you??";
$body="Hi What's Up??Come to see me sometimes.";
//echo $body;

$from="ruchivsanghvi@gmail.com";
$reply_to="ruchivsanghvi@gmail.com";
$headers .= "Content-type: text/plain\r\n";
$headers .= "From:Ruchi Sanghvi <$from> \r\n";
$headers .= "Reply-To: Admin <$reply_to>\n";
$headers .= "X-Mailer: PHP". phpversion() ."\n";
   
$res=mail("kinjalashukla@gmail.com",$subject,$body,$headers);



PHP has fabulous function for sending simple text and html mails.

The function is mail() function.

This function takes 4 parameters as follow:


to ->Email of receiver;
subject->subject of email.
body->message of email.
header->it takes extra parameter combination like from email,type of data,php version,reply to attributes etc.

this is very simple script.I hope u will enjoy it.