Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    New York
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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";
    }

    ?>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •