Quantcast
Viewing all articles
Browse latest Browse all 5

Send an email with PHP (HTML content supported)

Here is a php function with which you can send an email with normal text or in html format.

PHP code:

$email_to = "Where the email will be sended to.";
$email_from = "From where the email will be sended.";
$subject = "The subject of the email.";
$message = "The content of the email; can be in html format to.";

sendEmail($email_to, $email_from, $subject, $message);
       
function sendEmail($email_to, $email_from, $subject, $message){
    $headers = "Content-type: text/html; charset=utf-8"."\r\n";
    $headers .= "MIME-Version: 1.1"."\r\n";
    $headers .= "From:".$email_from."\r\n"
                       ."Reply-To:".$email_from;
       
    mail($email_to, $subject, $message, $headers);
}


Viewing all articles
Browse latest Browse all 5

Trending Articles