use of php mail function

php-sniplets Add comments

PHP supplies a function named mail that sends email from your script.

The format is as follows: mail(headers,address,message,subject);

These are the values you need to fill in:

address: The e-mail address that receives the message
subject: A string that goes on the subject line of the e-mail message
message: The content that comes in the e-mail message
headers: A string that sets values for e-mail headers

You may set and send an email message as follows:

$to = “”;
$subj = “Testing”;
$mess = “Testing the mail function”;
$headers =\r\n
$mailsend = mail($to,$subj,$mess,$headers);

The message is sent to the address in the $to variable.

You are able to send the message to more than one individual by using the following argument:

$to= “,”;

The $headers string in this case as well sends a blind copy of the message to You will
be able to let in more than one header as follows:

$header = “\r\”;

Headers are optional. Just the first 3 parameters are needed.

The $mailsend variable holds TRUE or FALSE. However, TRUE is no guarantee that the mail will get to wherever
it is going. It just implies that it started out O.K..

Leave a Reply

You must be logged in to post a comment.

Impressum Entries RSS Log in