Created
June 18, 2013 03:03
-
-
Save plasticbrain/5802390 to your computer and use it in GitHub Desktop.
PHP - Send Email
This file contains hidden or 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
| function send_email( $to, $from, $subject, $message, $html=true ){ | |
| // Set the headers | |
| $headers = "From: ".$from."\r\n"; | |
| $headers .= "Reply-To: ".$from."\r\n"; | |
| if( defined('BCC_CONTACT_EMAIL') ) { | |
| $headers .= 'Bcc: ' . BCC_CONTACT_EMAIL . "\r\n"; | |
| } | |
| // HTML email? | |
| if( $html ) { | |
| $headers .= "MIME-Version: 1.0\r\n"; | |
| $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; | |
| } | |
| // send the email | |
| return (bool) mail($to, $subject, $message, $headers); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment