PHP EMail

|

mail() function is used to send emails from inside a script in php. The Syntax of mail() function is as under.mail(to,subject,message,headers,parameters)



ParameterDescription
toRequired. Specifies the receivers email
subjectRequired. Specifies the subject of the email
messageRequired. Contain the message to be sent. Each line should be separated with a Line Fed (\n). Lines should not exceed 70 characters
headersOptional. Specifies additional headers, like From, Cc, and Bcc. The additional headers should be separated with a CRLF (\r\n)
parametersOptional. Specifies an additional parameter to the sendmail program.




$to = 'noname@testing.com';

$subject = 'E-mail subject';

$message = 'E-mail message';

$headers = 'From: webmaster@studiesinn.com' . "\r\n" .

'Reply-To: webmaster@ webmaster.com' . "\r\n" .

'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

?>