Jump to content

Recommended Posts

Posted

I'm new to PHP.

 

I'm getting the following error when executing the code below. I've tried reinstalling both PEAR Mail and PEAR Net/SMTP but the problem remains. Can someone tell me what I'm doing wrong?

 

Error:

 

Warning: include_once(Net/SMTP.php) [function.include-once]: failed to open stream: No such file or directory in /usr/lib/php/Mail/smtp.php on line 348

 

Warning: include_once() [function.include]: Failed opening 'Net/SMTP.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /usr/lib/php/Mail/smtp.php on line 348

 

Fatal error: Class 'Net_SMTP' not found in /usr/lib/php/Mail/smtp.php on line 349

 

Code:

 

<?php

require_once 'Mail.php';

 

$from = "Customer Service <customerservice@softsys.heliohost.org>";

$to = "msk7 <msk7@softsys.heliohost.org>";

$subject = "Hi!";

$body = "Hi,\n\nHow are you?";

 

$host = "ssl://stevie.heliohost.org";

$host = "65.19.143.2";

$port = "465";

$username = "customerservice+softsys.heliohost.org";

$password = "mypassword";

 

$headers = array ('From' => $from,

'To' => $to,

'Subject' => $subject);

$smtp = Mail::factory('smtp',

array ('host' => $host,

'port' => $port,

'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>");

}

?>

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...