How to send email from a php application - SMTP authentication

Our SMTP servers require that you pass SMTP authentication before relaying email from a php application. You can use the code below to define SMTP authentication.

<head><title>Test email via php</title></head> 
require_once "Mail.php"; 
$from = "Sender <>"; 
$to = "Recipient <>"; 
$subject = "This is a test email sent via php"; 
$body = "This is a test email"; 
$host = "[Mail Server Name]";  
$username = ""; 
$password = "email_password"; 
$headers = array ('From' => $from, 
  'To' => $to, 
  'Subject' => $subject); 
$smtp = Mail::factory('smtp', 
  array ('host' => $host, 
  'auth' => true, 
  'username' => $username, 
  'password' => $password)); 
$mail = $smtp->send($to, $headers, $body);echo "mail sent"; 

If you run into problems when using this code, please post in the DiscountASP.NET or Everleap community forum. Technical support is unable to assist with specific coding issues.