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

}

?>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...