Previously we provided a PHP code snippet on how to send an email using Mandrill, but if you don’t want to use a third-party service, you can use the PHP code snippet below.
- function send_mail($to,$subject,$body)
- {
- $headers = "From: KOONKrn";
- $headers .= "Reply-To: blog@koonk.comrn";
- $headers . = "Return-Path: blog@koonk.comrn";
- $headers .= "X-Mailer: PHP5n";
- $headers .= 'MIME-Version: 1.0' . "n";
- $headers .= 'Content -type: text/html; charset=iso-8859-1' . "rn";
- mail($to,$subject,$body,$headers);
- }
Copy code
Usage:
- $to = "admin@koonk.com";
- $subject = "This is a test mail";
- $body = "Hello World!";
- send_mail($ to,$subject,$body);
- ?>
Copy code
|