UK WEB HOSTING FORUM FOR DISCUSSION ON WEB HOSTING SERVICE AND SUPPORT
LINUX HOSTING WINDOWS HOSTING PACKAGES SHOPPING CART OSCOMMERCE ZEN CART AGORA
ECOMMERCE HOSTING ASP MSSQL FRONTPAGE HOSTING PHP MYSQL HOSTING DISCUSSION FORUM
CPANEL RESELLER HOSTING DEDICATED SERVER VPS HOSTING PLESK VIRTUOZZO
Quick Search
Your forum announcement here!

  eUKhost's Official Web Hosting Forum > Web Hosting and Domains > PHP Hosting

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-02-2010, 23:53
new member
 
Join Date: Jan 2010
Posts: 8
Default PEAR::Mail / Net_SMTP install issues

I'm currently attempting to setup a mail form using PEAR::Mail so I can take advantage of sending mail via an authenticated SMTP server. I currently have the following modules installed:
  • Archive_Tar (1.3.5)
  • Auth_SASL (1.0.3)
  • Console_Getopt (1.2.3)
  • Mail (1.1.14)
  • Net_SMTP (1.4.1)
  • Net_Socket (1.0.9)
  • PEAR (1.9.0)
  • Structures_Graph (1.0.3)
  • XML_Util (1.2.1)

The above was installed in the following order PEAR first then Mail (the other modules came with them). I then tried to execute the following code from /public_html/:

Code:
<?php
require_once "../php/Mail.php";

$from = "Test <sender@example.com>";
$to = "SteRiley <email@email.com>";
$subject = "This is a test message";
$body = "Did this work?";

$host = "ssl://mail.mydomain.com";
$port = "465";
$username = "myusername";
$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>");
 }
?>
However this returns the following error:

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

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

Fatal error: Class 'Net_SMTP' not found in /home/steriley/php/Mail/smtp.php on line 210
/php/Mail/smtp.php on line 206 is set to include_once 'Net/SMTP.php'; I assume something clever goes on to path it to the correct place? I've tried amending it to include_once '../Net/SMTP.php'; but this didn't help.

This is the first time I've attempted to use PEAR to it could be a n00b error, where am I going wrong?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-02-2010, 21:54
Rock's Avatar
Technical Support (eUKhost.com)
 
Join Date: Oct 2006
Location: localhost
Posts: 3,356
Send a message via MSN to Rock Send a message via Skype™ to Rock
Smile

Hi,

The PEAR::Net_SMTP module doesn't seem to be installed correctly &/or you need to make sure that the PHP PEAR directory falls under the include_path directive in the php.ini so that all the necessary files are included.

Please open up a support ticket with the necessary details of your account so we can take a closer look into this & get it sorted ASAP
__________________

Rock _a.k.a._ Jack
Windows Hosting || Windows Reseller Hosting
Cloud Hosting 100% UPTIME! || Powerful Dedicated Servers
Follow eUKhost on Twitter || Join eUKhost Community on Facebook

For complaints, grievances or suggestions kindly email our FeedBack Dept.
Proper action will be taken accordingly & instantaneously!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-02-2010, 14:32
ronniev's Avatar
Senior Member
 
Join Date: Oct 2008
Posts: 123
Lightbulb

Quote:
I'm currently attempting to setup a mail form using PEAR::Mail so I can take advantage of sending mail via an authenticated SMTP server. I currently have the following modules installed:

* Archive_Tar (1.3.5)
* Auth_SASL (1.0.3)
* Console_Getopt (1.2.3)
* Mail (1.1.14)
* Net_SMTP (1.4.1)
* Net_Socket (1.0.9)
* PEAR (1.9.0)
* Structures_Graph (1.0.3)
* XML_Util (1.2.1)


The above was installed in the following order PEAR first then Mail (the other modules came with them). I then tried to execute the following code from /public_html/:

Code:

<?php
require_once "../php/Mail.php";

$from = "Test <sender@example.com>";
$to = "SteRiley <email@email.com>";
$subject = "This is a test message";
$body = "Did this work?";

$host = "ssl://mail.mydomain.com";
$port = "465";
$username = "myusername";
$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>");
}
?>

However this returns the following error:

Code:

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

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

Fatal error: Class 'Net_SMTP' not found in /home/steriley/php/Mail/smtp.php on line 210

/php/Mail/smtp.php on line 206 is set to include_once 'Net/SMTP.php'; I assume something clever goes on to path it to the correct place? I've tried amending it to include_once '../Net/SMTP.php'; but this didn't help.

This is the first time I've attempted to use PEAR to it could be a n00b error, where am I going wrong?
I have made necessary changes under your account and now I am able to sending mail via an authenticated SMTP server without any error.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 22-09-2011, 21:55
new member
 
Join Date: Sep 2011
Posts: 2
Default Identical problem

Hi ronniev,
I have exactly the same problem.

What did you do to fix the problem?
Is it something I can do - or does it need to be done by an eukhost admin..?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 22-09-2011, 22:47
new member
 
Join Date: Sep 2011
Posts: 2
Default Solved

Well, after reading what feels like millions of posts from people with similar problems, I discovered this:

If you don't hav access to your php.ini file (eg. because it's shared on Windows boxes) you can add this line of code to your file:

set_include_path('../php/');

now this line of code
require_once "Mail.php";
should work.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT. The time now is 01:52.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
UK Web Hosting by eUKHosting 3.1.0
UK Web Hosting by eUKHosting 3.1.0
Copyright © 2001-2012, eUKhost LTD. All rights reserved.

 


UK VPS Hosting
VPS Hosting plans

Dedicated Server Hosting
Dedicated Server plans

VoIP Dedicated Servers
Asterisk, Trixbox Dedicated Servers

Business Web Hosting
100% uptime Hosting

UK Cpanel Hosting
cPanel Shared Hosting

Domain Hosting
Cheap Domains & Hosting Plans

UK Reseller Hosting
Reseller Web Hosting

Windows Hosting
Windows Shared Hosting

Windows VPS

Windows VPS Hosting

Semi Dedicated Servers
Semi-Dedicated Hosting

Dedicated Server Mirroring
Dedicated Server Mirroring

Webhosting Knowledgebase
Frequently asked Questions

Web Hosting Blog
eUKhost Blog

Web Hosting Support
Support Helpdesk

UK Data Center
eUKhost Datacenter

Web Hosting Forum
eUKhost Forum

Support Tutorials
Online Flash Tutorials

Offsite Back-up Plans
Remote Backup Service

ColdFusion Hosting
ColdFusion Web Hosting
 
 

Android and Apple App


knowledgebase articles
eUKhost.com Services

Pre-Sales Questions
Pre-sales FAQ's

Domain Names
Domain registration FAQ's

cPanel Hosting
cPanel Hosting FAQ's

Windows Web Hosting
Plesk Control Panel

Reseller Hosting
Reseller Hosting FAQ's

VPS Hosting
Virtual Private Server

Semi-Dedicated Servers
Semi-Dedicated FAQ's

Dedicated Servers
Dedicated Server Hosting

Joomla Hosting
Joomla Web Hosting

Mambo Hosting
Mambo Web Hosting

Magento Hosting
Magento Web Hosting

Wordpress Hosting
Wordpress Web Hosting

 

Web Hosting Affiliate Program
 

popular blog categories

UK Web Hosting
UK Hosting articles

Dedicated Server Hosting
Dedicated Server guidelines

VPS Hosting
VPS hosting articles

cPanel Hosting
cPanel Hosting articles

Linux Operating System
Linux Operating techniques

Windows Web Hosting
Windows plesk articles