PHP Send Mail (HTML) Script

 

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:

  • 0 gebruikers vonden dit artikel nuttig
Was dit antwoord nuttig?

Related Articles

Safe Mode and open_basedir

Safe ModeThe PHP safe mode is an attempt to solve the shared environment server security problem....

Enable display_errors In PHP

Enable display_errors For PHP The web server by default do not have the display_errors turned on...

Enable PHP with Register Globals Turned On

This setting applied to both PHP version 4.x and 5.x. After this tutorials, you will be able to...

PHP increase the session timeout

If you wish to increase the session timeout, you may include the following command line in to the...

Do You Support $_Server['DOCUMENT_ROOT'] ?

$_Server['DOCUMENT_ROOT'] is referring to doc_root value in php.ini which is currently set to...