Results 1 to 5 of 5
  1. #1

    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?

  2. #2
    Join Date
    Oct 2006
    Location
    localhost
    Posts
    3,375

    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!

  3. #3
    Join Date
    Oct 2008
    Posts
    123

    Lightbulb

    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.

  4. #4
    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..?

  5. #5
    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.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •