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 = “yourname@sitename.com”;
$subj = “Testing”;
$mess = “Testing the mail function”;
$headers = bcc:help@sitename.com\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= “yourname@sitename.com,secondname@secondsite.com”;
The $headers string in this case as well sends a blind copy of the message to support@sitename.com. You will
be able to let in more than one header as follows:
$header = “cc:info@sitename.com\r\nbcc:sales@sitename.com”;
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..
March 15th, 2008 at 1:00 am
[…] banking@millarassociates.com wrote an interesting post today onHere’s a quick excerptPHP 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 … […]
March 16th, 2008 at 2:49 pm
Better you use mb_send_mail(), so you can use your own encoding. The arguments are the same as in mail().
You predefine mail’s encoding by mb_language($type). $type can be ‘ja’ (japanese), ‘en’ (standard iso encoding) or ‘uni’ (unicode). I prefer using UTF8 for mail in future because it’s the world wide standard for string encoding.