Jump to content

Sending HTML email


acctman

Recommended Posts

Currently my script uses the code below to send out a text formated reg_confirm.tpl email template. How can I change the coding so that it sends out HTML formated emails

 

 

//parses email templates
function emailtemplate($template_file) {
        global $en;
        $f = fopen($template_file,'r');
        if (!$f) die('Couldn`t open '.$template_file.'!');
        $lines = 0;
        while (!feof($f)) {
                $lines++;
                $s = chop(fgets($f,4096));

                if ($lines == 1){ $out[subj] = $s;} else
                        {$out[body] .= $s."\n";}
                }
        fclose($f);
        
        return emailtemplatetxt($out['subj'],$out['body']);
        }


//send confirmation email
        $message = emailtemplate('emails/reg_confirm.tpl');     

        mail($en['email'], $message[subj], $message[body],
             "From: ".admin_email."\r\n"
            ."Reply-To: ".admin_email."\r\n"
            ."X-Mailer: PHP/" . phpversion());

Link to comment
https://forums.phpfreaks.com/topic/124240-sending-html-email/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.