You need to use the email credentials you create in Plesk to authinticate to the server.

Also this uses the Pear library but should work regardless.

 

 

<?php
error_reporting(E_ALL);
ini_set('display_errors','On');

include('Mail.php');



$recipients = 'toaddress@something';

$headers['From'] = 'fromyou@yourdomain';
$headers['To'] = $recipients;
$headers['Subject'] = ' Test message ';
$body = 'Test message body';


$smtp_params["host"] = "localhost";
$smtp_params["port"] = "25";
$smtp_params["auth"] = true;
$smtp_params["username"] = "someemail@yourdomain"; // you made in plesk
$smtp_params["password"] = "you-secret-password"; //you set this in plesk for the email account



$mail =& Mail::factory("smtp", $smtp_params);
$result = $mail->send($recipients, $headers, $body);
if($result == 1)
{
echo 'Your message has been sent!
IP Address: '.$ip.' Code: '.
$result.'<br/><br/>';

}
else
{
echo 'Message failed!
IP Address: '.$ip.'<br/>'.' Code: '.
$result.'<br/><br/>';
}

 

?>