Blog Details

mail() Function



                                

* PHP mail() Function :-

  • The mail() function allows you to send emails directly from a script.

Syntax :

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

 to    :                          

           Required. Specifies the receiver / receivers of the email subject  :                     Required. Specifies the subject of the email. Note: This parameter cannot contain any newline characters message   :                                     Required. Defines the message to be sent. Each line should be separated with a LF (\n). Lines should not exceed 70                           characters. headers   :                                     Optional. Specifies additional headers, like From, Cc, and Bcc. The additional headers should be separated with a CRLF                    (\r\n). parameters   :                           Optional. Specifies an additional parameter to the sendmail program (the one defined in the sendmail_path                                           configuration setting).

Example :

<?php $to = "somebody@example.com"; $subject = "My subject"; $txt = "Hello world!"; $headers = "From: webmaster@example.com" . "\r\n" . "CC: somebodyelse@example.com"; mail($to,$subject,$txt,$headers); ?>


Categories

Core_PHP

Latest posts

13.05.14
Implementing CRUD Operations ¶

<ul> <li>Now comes the fun part. We would like t

13.05.14
View

<ol> <li><a href="http://www.yiiframework.com/do

13.05.14
Creating Model

<ol> <li><a href="http://www.yiiframework.com/do

Get Free Quote