Skip to content

Instantly share code, notes, and snippets.

@sharifulislam52
Created March 5, 2018 11:38
Show Gist options
  • Save sharifulislam52/316ca1382969e4ea44ef5171acc2fb7e to your computer and use it in GitHub Desktop.
Save sharifulislam52/316ca1382969e4ea44ef5171acc2fb7e to your computer and use it in GitHub Desktop.
Send Mail From Server
<?php
$to = "to_mail@example.com";//change receiver address
$subject = "This is subject";
$message = "<h1>This is HTML heading</h1>";
$header = "From:from_mail@example.com \r\n";
$header .= "MIME-Version: 1.0 \r\n";
$header .= "Content-type: text/html;charset=UTF-8 \r\n";
$result = mail ($to,$subject,$message,$header);
if( $result == true ){
echo "Message sent successfully...";
}else{
echo "Sorry, unable to send mail...";
}
?>
<?php
ini_set("sendmail_from", "from_mail@example.com");
$to = "to_mail@example.com";//change receiver address
$subject = "This is subject";
$message = "This is simple text message.";
$header = "From:from_mail@example.com \r\n";
$result = mail ($to,$subject,$message,$header);
if( $result == true ){
echo "Message sent successfully...";
}else{
echo "Sorry, unable to send mail...";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment