Created
July 17, 2013 18:24
-
-
Save lenn4rd/6023080 to your computer and use it in GitHub Desktop.
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 | |
/* Sends a test email with PHP's mail() method | |
* | |
* Put this file on your web server or run it from the command line: | |
* | |
* php test_php_mail.php | |
* | |
* When testing locally, i.e. on your development machine, make sure that | |
* you set a valid from address for sendmail unless your machine doesn't | |
* have a valid, fully qualified domain name (FQDN). | |
* | |
* In your php.ini: | |
* | |
* sendmail_path = /usr/sbin/sendmail -t -i -f "[email protected]" | |
* | |
* Your mail host will very likely reject mails originating from unknown | |
* domains such as <your-computer-name.local> since that is where most | |
* spam mails come from. | |
* | |
* Based on: http://www.der-webentwickler.net/php-mysql/mail-versand-unter-php-testen/ | |
*/ | |
$to = "<[email protected]>"; | |
$subject = "mail() with PHP"; | |
$text = "Lorem ipsum dolor sit amet."; | |
$headers = "From: $to\r\n"; | |
if (mail($to, $subject, $text, $headers)) { | |
echo "Email was sent successfully.\n"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment