JackLatanis
JackLatanis
Reputation Top 5%
Jack Latanis
1 Snippet
Published
1 Channel
Created
1 Channel
Following
41 points
Reputation
Junior Code Generator
Junior Publisher
Junior Trend Maker
Junior Popular Coder
Junior Autobiographer
Senior Autobiographer
Junior Wise Coder

Recent Snippets See all snippets by JackLatanis

public by  298057  7  6  -1

Sending email via AuthMailer service using PHP

//this code sends emails via AuthMailer service (www.authmailer.com)

<?

//install the Mail, Net_Socket and Net_SMTP with PEAR
require_once "Mail.php";
 
//mail headers and body
$from = "Me";
$to = "You";
$subject = "Subject";
$body = "Lorem Ipsum...";

//server configuration, edit with your account details 
$host = "authmailer.com";
$port = "587";
$user = "user";
$pass = "pass";
 
$headers = array('From' => $from,
	'To' => $to,
	'Subject' => $subject);

$smtp = Mail::factory('smtp',
	array('host' => $host,
	'auth' => true,
	'username' => $user,
	'password' => $pass));

//sending email
$mail = $smtp->send($to, $headers, $body);
 
if (PEAR::isError($mail)) 
{
  //something went wrong
	echo($mail->getMessage());
} 
else 
{
  //OK
	echo("Message was sent!");
}

?>
;