Monday 14 July 2014

How to send email in PHP

Before Starting...

Know about file location

1.Your index.php must be in server side.
Note :It is not working in localhost.
index.php
<?php
$to      = 'gauravrautela123@gmail.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: gauravrautela123@gmail.com' . "\r\n" . phpversion();
mail($to, $subject, $message, $headers);
?>

Terminology:
$headers : Receiver email  address,you can attach more than one email addresses.
$to : Sender email address.

 


1 comment: