Mail.php & Smtp Authentication Issue
===

 I've been trying to utilize a mail.php file from the jquery contactable plugin (found on google!) to use on my website. Although the script provided is fairly simple I'm running into issues with integrating it with my Host's SMTP requirement. Here is the original script without SMTP authentication: 
    
    <?php
    	// Assign contact info
    	$name = stripcslashes($_POST['name']);
    	$emailAddr = stripcslashes($_POST['email']);
    	$issue = stripcslashes($_POST['issue']);
    	$comment = stripcslashes($_POST['message']);
    	$subject = stripcslashes($_POST['subject']);	
    	
    	// Set headers
    	$headers  = 'MIME-Version: 1.0' . "\r\n";
    	$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
    	// Format message
    	$contactMessage =  
    	"<div>
    	<p><strong>Name:</strong> $name <br />
    	<strong>E-mail:</strong> $emailAddr <br />
    	<strong>Issue:</strong> $issue </p>
    
    	<p><strong>Message:</strong> $comment </p>
    
    	<p><strong>Sending IP:</strong> $_SERVER[REMOTE_ADDR]<br />
    	<strong>Sent via:</strong> $_SERVER[HTTP_HOST]</p>
    	</div>";
    
    	// Send and check the message status
    	$response = (mail('mymail@mymail.com', $subject, $contactMessage, $headers) ) ? "success" : "failure" ;
    	$output = json_encode(array("response" => $response));
    	
    	header('content-type: application/json; charset=utf-8');
    	echo($output);
    	
    ?>
    
I've tried using suggestions from Google and played around with it for hours. Here is the latest version based on my nil-understanding of php thus far. -__- (Based on this: http://blog.geek4support.com/php-mail-script-with-smtp-authentication-how-to-send-mails-by-php-mail-script-using-smtp-authetication/)
    
    <?php
     require_once "Mail.php";
    
    	// Assign contact info
    	$name = stripcslashes($_POST['name']);
    	$emailAddr = stripcslashes($_POST['email']);
    	$issue = stripcslashes($_POST['issue']);
    	$comment = stripcslashes($_POST['message']);
    	$subject = stripcslashes($_POST['subject']);	
    	
    	
     $host = "mail.mywebsite.com";
     $username = "mywebsitemail@mywebsiteaddress.com";
     $password = "mymailpassword";
     
    	// Set headers
    	$headers  = 'MIME-Version: 1.0' . "\r\n";
    	$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
    	// Format message
    	$contactMessage =  
    	"<div>
    	<p><strong>Name:</strong> $name <br />
    	<strong>E-mail:</strong> $emailAddr <br />
    	<strong>Issue:</strong> $issue </p>
    
    	<p><strong>Message:</strong> $comment </p>
    
    	<p><strong>Sending IP:</strong> $_SERVER[REMOTE_ADDR]<br />
    	<strong>Sent via:</strong> $_SERVER[HTTP_HOST]</p>
    	</div>";
    
     $smtp = Mail::factory('smtp',
       array ('host' => $host,
         'auth' => true,
         'username' => $username,
         'password' => $password));
    
    
     $response = ($smtp->send('mymail@mymail.com', $subject, $contactMessage, $headers))  ? "success": "failure";
    $output = json_encode(array("response" => $response));	
    	header('content-type: application/json; charset=utf-8');
    	echo($output);
    	
     ?>
    
Comments, suggestions, anything would be most appreciated! :-)