trying to email in php. getting an error with NET_SMTP.

  • Answered
looks as if 'Net_SMTP' is not in correct directory or php ini does not includes the correct directory.
I'm getting the following error :
Warning: include_once(Net/SMTP.php): failed to open stream: No such file or directory in /usr/local/lib/php/Mail/smtp.php on line 348

Warning: include_once(): Failed opening 'Net/SMTP.php' for inclusion (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

Hello, and thanks for the question.

I did some digging around and I stumbled across this obsolete construction of NET_SMTP PEAR PHP bug . It looks like since PHP 5.4 the Net_SMTP line can't have the & symbol in it.

I'd recommend either using phpMailer to send mail from PHP, or you could run multiple versions of PHP on your account and from the directory that you're trying to run your mail script use this line in your.htaccess file:

AddHandler application/x-httpd-php5 .php

It looks like that PEAR bug is still open and hasn't been resolved yet, so these would probably be your best alternatives for getting email working from PHP.

Please let us know if you're still having any issues at all.

- Jacob