Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Skoua/e8fc13fae728aac74bfcad1c2e552193 to your computer and use it in GitHub Desktop.
Save Skoua/e8fc13fae728aac74bfcad1c2e552193 to your computer and use it in GitHub Desktop.
Send Mail using mail function in PHP
<?php
/* Source: http://www.apphp.com/index.php?snippet=php-get-remote-ip-address */
$to = 'myfriend@gmail.com';
$subject = 'Test Email';
$body = 'Body of your message here. You can use HTML tags also, e.g. <br><b>Bold</b>';
$headers = 'From: John Smith'."\r\n";
$headers .= 'Reply-To: from@email.me'."\r\n";
$headers .= 'Return-Path: from@email.me'."\r\n";
$headers .= 'X-Mailer: PHP5'."\n";
$headers .= 'MIME-Version: 1.0'."\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
mail($to, $subject, $body, $headers);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment