Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-13-2003, 03:57 AM   PM User | #1
isleshocky77
New Coder

 
Join Date: Jul 2002
Location: New York
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
isleshocky77 is an unknown quantity at this point
Web Email Template

I am emailing a thank you page to customers after they sign up. I have the signup page done and I also have an html version and a text version of the email setup. I would like to know if anyone knows any good sites or could help me in making the html page which is written in PHP and has variables to fill in a template and to email it using the mail() function. Thank you.
__________________
-Stephen
isleshocky77 is offline   Reply With Quote
Old 02-13-2003, 12:26 PM   PM User | #2
missing-score
Senior Coder


 
missing-score's Avatar
 
Join Date: Jan 2003
Location: UK
Posts: 2,194
Thanks: 0
Thanked 0 Times in 0 Posts
missing-score is on a distinguished road
No sites but...

I don't know any sites but I know how you can.

What you need to do is set it as a multipart message. I took the example below from another thread in this forum that I saved ages ago.
PHP Code:
<?php
function send_multipart_mail($from$to$subject$part1$part2)
{
    
// the parts must be separated by the $separator string
    // you can choose it anyway you like and when you
    // use it, it has to start with -- (2 hyphens)

    
$separator '__00';

    
// just 20 random characters

    
for ($i=0$i<20$i++) {
    
$separator .= chr(rand(ord('A'),ord('z')));
    }

    
$header "From:$from\n";
    
$header .= "Reply-To: ".$from."\r\n";
    
$header .= "MIME-Version: 1.0\r\n";
    
$header .= "Content-Type: Multipart/alternative; boundary=\"$separator\"\r\n";
    
$header .= "Content-Disposition: inline;\r\n";
    
    
// the first part is just sthe text version that is passed to the function as $part1
    
$message "\n\n--$separator\r\n";
    
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
    
$message .= "Content-Transfer-Encoding: 8bit\r\n";
    
$message .= "$part1\n";
    
    
//$message .= "Content-Disposition: inline;\n\n";
    // the second part is the html version passed to the function as $part2
    
$message .= "\n--$separator\r\n";
    
$message .= "Content-Type: text/html; charset=iso-8859-1\r\n";
    
$message .= "Content-Transfer-Encoding: 8bit\r\n";
    
$message .= "Content-Disposition: inline;\n\n";
    
$message .= "$part2\n";
    
    
// the last separator begin and ends(!) with --
    
$message .= "--$separator"."--\n";

return 
mail ($to$subject$message$header);


echo 
"test for multipart emails<br>";
$to "01matthew.wilson@ashdown.poole.sch.uk";
$from "yoyur@emaosmart.com";
$subject "finaly multipart emails ";
$part1 "this is bold text right here on part 1 text version!";
$part2 "<img src=\"$itf\" /><br /><br /><font face=\"verdana\" size=\"5\"><br><i>this</i> is <b>bold</b> <a href=#>text</a> right here on part 2!</font>";

if(
send_multipart_mail($from$to$subject$part1$part2))
{
    echo 
"email was accepted for dilivery";
}else{
    echo 
"email was not accepted for dilivery";
}

?>
missing-score is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:37 AM.


Advertisement
Log in to turn off these ads.