Skip to content

Instantly share code, notes, and snippets.

@ademar
Created August 21, 2015 13:21
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 ademar/235f765d6104162cb2d3 to your computer and use it in GitHub Desktop.
Save ademar/235f765d6104162cb2d3 to your computer and use it in GitHub Desktop.
PHP example : Sending email and performing SMTP authentication with Pearl Mail package
<?
# 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