Skip to content

Instantly share code, notes, and snippets.

@luanlmd
Created April 16, 2010 18:27
Show Gist options
  • Save luanlmd/368772 to your computer and use it in GitHub Desktop.
Save luanlmd/368772 to your computer and use it in GitHub Desktop.
Sending email with PEAR Mail class
<?php
include("Mail.php");
//$headers['Reply-to'] = "$name <$email>";
$headers['From'] = 'username@gmail.com';
$headers['Subject'] = "Test";
$headers['Content-Type'] = "text/plain; charset=utf-8";
$recipients = 'luckyguy@gmail.com';
$body = 'Something';
$smtpinfo["host"] = "smtp.gmail.com";
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "username";
$smtpinfo["password"] = "password";
$mail =& Mail::factory('smtp', $smtpinfo);
echo $mail->send($recipients, $headers, $body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment