Currently, I learnt to send email just using php script. It made me reliazed that PHP is very powerful server side language.
Below is an example that using php script to send email... Enjoy it!
$to = 'scleong@gmail.com';
$subject = 'Red alert!';
$message = 'yo, whassup?';
$headers = "From: admin@pknpk.gov.my\r\n" .
'X-Mailer: PHP/' . phpversion() . "\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: text/html; charset=utf-8\r\n" .
"Content-Transfer-Encoding: 8bit\r\n\r\n";
// Send
$is_send = mail($to, $subject, $message, $headers);
if ($is_send)
echo "email have been sent to $to successfully";
else
echo "Failed to send the E-mail.";
No comments:
Post a Comment