Line No | Coding |
1 | |
2 | $to = 'user1@OtherDomain.com' . ','; //Specify Multiple Recipients |
3 | $to .= 'user2@OtherDomain.com'; |
4 | $subject = 'My PHP Email'; //Specify Email Subject |
5 | $message = ' |
6 | |
7 | |
8 | |
9 |
|
10 | |
11 |
Hello World, |
12 |
My Testing HTML Email! |
13 | |
14 | '; //Specify Email Message |
15 | $headers = 'MIME-Version: 1.0' . "\r\n"; |
16 | $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; |
17 | //To send HTML mail, the Content-type header must be set |
18 | $headers .= 'From: iwebhosting.com.my ' . "\r\n"; //Specify Sender |
19 | $headers .= 'Bcc: user2@mail.com' . "\r\n"; //Specify Bcc User |
20 | mail($to, $subject, $message, $headers); //sent it |
21 | ?> |
Line No | Explanation |
1 | Open PHP tag |
2 - 3 |
PHP Mail Proties: Recipients |
4 |
PHP mail properties: Email Subject |
5 - 14 |
HTML email content |
15 - 19 |
Set PHP mail properties |
20 | Sent Mail |
21 |
Close PHP Tag |
Sample Coding: