PHP/Email/mail function
Содержание
Mail cc and bcc
<source lang="html4strict">
<?php
$headers = "From:sender@wbex.ru\r\n"; $recipients = "b@java.ru,a@java.ru"; mail($recipients, "This is the subject","This is the mail body", $headers);
?>
</source>
Mail to multiple recipients
<source lang="html4strict">
<?php
$headers = "From:sender@wbex.ru\r\n"; $recipients = "test@java.ru,a@wbex.ru"; mail($recipients, "This is the subject","This is the mail body", $headers);
?>
</source>
Multiple recipients all go into the address field, with commas separating them
<source lang="html4strict">
<?php $mailsend = mail("receiver@receipthost, a@hotmail.ru, a@aol.ru", "A Sample Subject Line", "Body of e-mail."); print("$mailsend"); ?>
</source>
Use the mail function
<source lang="html4strict">
<?php mail("receiver@receipthost.ru", "A Sample Subject Line", "Body of e-mail\r\nwith lines separated by the newline character."); ?>
</source>
Use variables in mail function
<source lang="html4strict">
<?php $address = "a@b.ru"; $Subject = "All I want for Christmas"; $body = "Joe"; $mailsend = mail("$address", "$Subject", "$body."); print("$mailsend"); ?>
</source>