Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Net_smtp error

  1. #1
    New to the CF scene
    Join Date
    Jul 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Net_smtp error

    HI there,

    Warning: include_once(Net/SMTP.php) [function.include-once]: failed to open stream: No such file or directory in C:\wamp\bin\php\php5.3.5\Mail-1.2.0\Mail-1.2.0\Mail\smtp.php on line 348

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    As it says:

    Quote Originally Posted by m.prajapati85 View Post
    Warning: include_once(Net/SMTP.php) [function.include-once]: failed to open stream: No such file or directory in C:\wamp\bin\php\php5.3.5\Mail-1.2.0\Mail-1.2.0\Mail\smtp.php on line 348
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #3
    New to the CF scene
    Join Date
    Jul 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    code

    require_once "C:\wamp\bin\php\php5.3.5\Mail-1.2.0\Mail-1.2.0\Mail.php";

    $from = "Sandra<aaaaa@xxxxx.com>";
    $to = "Ramona<xxxxx@xxxxx.com>";
    $subject = "Hi!";
    $body = "Hi,\n\nHow are you?";

    $host = "mail.xxxxx.com";
    $port = "25";
    $username = "xxxxx@xxx.com";
    $password = "xxxxxx";

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

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Its not the code that's wrong, its your paths (okay, I'll concede that that *could* be seen as code :P).
    This error: No such file or directory in C:\wamp\bin\php\php5.3.5\Mail-1.2.0\Mail-1.2.0\Mail\smtp.php to the warning: Net/SMTP.php says it cannot load the file located here: C:\wamp\bin\php\php5.3.5\Mail-1.2.0\Mail-1.2.0\Net\SMTP.php. To start, always work relative, never use full file paths (errors will still show the same though, relative is to prevent locking on directories which requires modification to use on different servers).

    Start by looking in this path: C:\wamp\bin\php\php5.3.5\Mail-1.2.0\Mail-1.2.0\.
    You need to confirm that:
    1. A file under .\Mail\stmp.php exists (which appears to me does).
    2. A file under .\Mail\Net\smtp.php exists (which does not appear to be).

    The smtp is called via the use of Mail::factory (if I had to guess, since that makes sense overall to the idea of a factory).
    Assuming this file is stmp.php, change that first line to this:
    PHP Code:
    require_once __DIR__ '/../Mail.php'
    Which should work (__DIR__ only exists in 5.3+, and you appear to be including one directory above).

    For number 2, assuming that the file is not there, you're options are to either a) move it there and hope you break no dependencies by doing so, b) correct the filepath which would require modifying the Mail class to register the proper filepaths. If you're really lucky, the filepaths may be a simple configuration issue in another file.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

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