dyesin
2/15/2014 - 7:13 AM

Function to send HTML email

Function to send HTML email

<?php

$test = send_email ("to_email@email.com, "subject line", "body of the email");

    function send_email($email_addr, $subject_line, $email_body) {
        $from = 'www.example.com';
        $reply = 'webmaster@example.com';

        $subject = stripslashes($subject_line);
        $message = urldecode($email_body);
        $to = urldecode($email_addr);

        $headers = "From: " . $from . "\r\n";
        $headers .= "Reply-To: " . $reply . "\r\n";
        $headers .= "MIME-Version: 1.0\r\n";
        $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

        mail($to, $subject, stripslashes($message), $headers);
    }
    
  ?>