I get an error, for example:
Warning: include_once (Net / SMTP.php) [function.include-once]: could not open the stream: there is no such file or directory in /usr/local/lib/php/Mail/smtp.php on line 348
Warning: include_once () [function.include]: Failed to open 'Net / SMTP.php' to enable (include_path = '.: / Usr / lib / php: / usr / local / lib / php') in / usr / local / lib / php / Mail / smtp.php on line 348
Fatal error: class 'Net_SMTP' not found in /usr/local/lib/php/Mail/smtp.php on line 349
My code is:
require_once 'Mail.php';
$from = "me@example.com>";
$to = "you@gmail.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "mail.example.com";
$username = "me";
$password = "test";
$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);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
source
share