Created
August 21, 2015 13:21
-
-
Save ademar/235f765d6104162cb2d3 to your computer and use it in GitHub Desktop.
PHP example : Sending email and performing SMTP authentication with Pearl Mail package
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 example : Sending email and performing SMTP authentication with Pearl Mail package | |
include_once("Mail.php"); | |
$recipients = 'mail_to@domain.mail'; | |
$headers["From"] = 'mail_from@domain.mail'; | |
$headers["To"] = 'mail_to@domain.mail'; | |
$headers["Subject"] = "Test message"; | |
$body = "TEST MESSAGE!!!"; | |
$params["host"] = 'smtp.yourdomain.com'; | |
$params["port"] = '25'; | |
$params["auth"] = true; | |
$params["username"] = 'account@yourdomain.com'; | |
$params["password"] = "password"; | |
// Create the mail object using the Mail::factory method | |
$mail_object =& Mail::factory("smtp", $params); | |
$mail_object->send($recipients, $headers, $body); | |
echo "Email sent." | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment