Created
March 5, 2018 11:38
-
-
Save sharifulislam52/316ca1382969e4ea44ef5171acc2fb7e to your computer and use it in GitHub Desktop.
Send Mail From Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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..."; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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