| | |
How we can send html page or template in mail in PHP ???
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2009
Posts: 130
Reputation:
Solved Threads: 0
Hi all,
I am working on an application in php. Now my client want that when i will send mail from form then in message there should be some html code or template of html. Please tell me how i can send this through mail of PHP.
Let me explain:
Like we send mail in php like this :
Now i want that in $message there should be some html code in which i can use color and some links . That should appear in mail after filling form.
So please help me . How i can do this in PHP.
Thanks,
Gagan
I am working on an application in php. Now my client want that when i will send mail from form then in message there should be some html code or template of html. Please tell me how i can send this through mail of PHP.
Let me explain:
Like we send mail in php like this :
mail($mailto,$subject,$message,"From:$email1"); Now i want that in $message there should be some html code in which i can use color and some links . That should appear in mail after filling form.
So please help me . How i can do this in PHP.
Thanks,
Gagan
You only need the first 2 lines of the headers below, but there's some additional headers in case you wanted to see how to add those as well. Also, make sure to "\r\n" in double quotes, not single quotes, AND they must appear at the end of every line in the headers
PHP Syntax (Toggle Plain Text)
// Additional headers $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n"; $headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n"; $headers .= 'Cc: birthdayarchive@example.com' . "\r\n"; $headers .= 'Bcc: birthdaycheck@example.com' . "\r\n"; mail($to, $subject, $message, $headers);
Your absolutely right omniuni, I would use utf-8 instead. Since my site is completely in English, it hasn't made a difference (to me). But in general you never know what countries/languages your visitors will be coming from and this is something you should get right the first time so you never have to worry about it.
PHP Syntax (Toggle Plain Text)
$headers.= 'Content-Type: text/html; charset=UTF-8' .' "\r\n";
Hello, All this code will help you to send mail but in mail if you need same like home page or you want to show image in mail or css or html code with same color then you have to change all the path of image to server page means your images in image floder so your current page will be images/image name Now when you want to show this image into mail then your path will he http://domainname.com/images/image name
Same for CSS and all the path
i hope this will help you ..
Regards
Same for CSS and all the path
i hope this will help you ..
Regards
hire-phpdeveloper.com
Start from $3.99 Per Hour
Web Development with php | Hire a dedicated php developer |Hire indian Php developer
Start from $3.99 Per Hour
Yahoo IM :hirephpdeveloperWeb Development with php | Hire a dedicated php developer |Hire indian Php developer
![]() |
Similar Threads
- Can I use a template html page within another html page (Site Layout and Usability)
- smtp mail in php (PHP)
- Update HTML page using PHP (PHP)
- PHP in a html page? (PHP)
- Sending E-mail Within PHP (PHP)
Other Threads in the PHP Forum
- Previous Thread: file hosting script. PHP
- Next Thread: MD5 forgot password
| Thread Tools | Search this Thread |
301 apache api array autosuggest beginner binary broken cakephp checkbox class cms code compression cron curl data database date display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google href htaccess html httppost if...loop image include insert ip javascript joomla jquery key library limit link links login mail md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote screen script search searchbox server session sessions sms sorting source space sql syntax system table tutorial update upload url validator variable video volume votedown web website youtube zend





