Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    11
    Rep Power
    0

    Sending mail from conatct form


    i am using this code to send a mail from my contact form page of my website...Its working fine if i am running it on my local machin but when i am putting this code on website then its not working .....can any one tell me how to resolve this problem..help appreciated.
    I think some problem is there bcoz of mail.php ..
    I am getting this error:
    Warning: require_once(Mail.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/29/10562829/html/sendmail.php on line 9

    Fatal error: require_once() [function.require]: Failed opening required 'Mail.php' (include_path='.:/usr/local/php5_3/lib/php') in /home/content/29/10562829/html/sendmail.php on line 9
    Code:
    <?php
     require_once "Mail.php";
     $from = "efwfw7@gmail.com";
     $to = "wff@gmail.com";
     $subject = "Client Order";
     $body .= "Client Name :"  .$_POST['name']." \n"
              .$_POST['email']." \n"
    		  .$_POST['phone']." \n" 
    		  .$_POST['msg'];
     $host = "smtp.gmail.com";
     $username = "fjhfhkf@gmail.com";
     $password = "gfegegeg";
     $headers = array ('From' => $from,'To' => $to,'Subject' => $subject);
     $smtp = Mail::factory('smtp',array ('host' => $host,'auth' => true,'username' => $username,'password' => $password));
     $mail = $smtp->send($to, $headers, $body);
     if (PEAR::isError($mail)) {
       echo("<p>" . $mail->getMessage() . "</p>");
      }else {
       echo 'We have received your order. Our Excutive will contact You soon..';
      }
     ?>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,464
    Rep Power
    594
    1) Please use [ PHP ] tags for your code. See the sticky at the top of this forum.

    2) The message is quite clear. Your script requires the file Mail.php but either you didn't copy it to the right location from your development environment or it is already in a different location in your production environment.

    Comments on this post

    • ManiacDan agrees : So easy. The messages are in English
    • bisen agrees
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    11
    Rep Power
    0
    But this script is working on my local machine...It means that mail.php is available at my development environment some where in the XAMMP.i am able to send mail from the contact page of my website.I have to put mail.php in the same folder at my production environment. Still i am getting the same error.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Location
    Nebraska, USA
    Posts
    875
    Rep Power
    275
    I'm gonna go out on a limb here and assume that your Mail.php file is part of a PEAR pkg that is installed on your local devel machine.....Which does not seem to be installed/available on your web hosting environment[just looking at your include path].

    If this is the case, you may need to use PHPMailer instead and rewrite your script to use it instead.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    11
    Rep Power
    0
    thanks, i think you are right .Pear pkg is not intalled on my web hosting environment. Is there any way so that i can use the same script...
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Location
    Nebraska, USA
    Posts
    875
    Rep Power
    275
    not without having PEAR installed on your web host. The PEAR::Mail script depends the PEAR core files.
    It will be much simpler for you to just use PHPMailer script...as you will be able to upload it directly to your host and use it..unlike PEAR which would need to be installed most likely by your web host company.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    11
    Rep Power
    0
    thank you so much for the help...
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    11
    Rep Power
    0
    if i am using PHPMailer script then i think i will have to change in mail function in php.ini file .Can u assist me what changes i need to do in php.ini if i am using php mailer function....can u give me a sample code
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Location
    Nebraska, USA
    Posts
    875
    Rep Power
    275
    everything you need to know about how to set it up to use can be found HERE...[on their wiki page]

    the download pkg itself even has examples..and I don't recall anything needing to be changed in your php.ini file to use PHPMailer.
  18. #10
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    11
    Rep Power
    0
    can u send me a sample working script through which i can send mail from the website.
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    11
    Rep Power
    0
    i have installed pear package on my production environment...using this refrence
    http://support.godaddy.com/help/article/6761/installing-pear-on-linux-web-hosting?locale=en&ci=46061
    an in the seventh step of the above ref. i.e
    Once the installation completes, update the php5.ini file with include_path:

    “.:/usr/local/php5/lib/php:/absolutepath/PEAR”

    i think i am doing some mistake in setting the path beacuse of that i am getting the same error that i was getting earlier.
    Can you assist me how to set the path in php5.ini file....
    i have got the absolute path by this ref.
    http://support.godaddy.com/help/article/58/finding-your-hosting-accounts-absolute-path?locale=en&ci=46061
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Location
    Nebraska, USA
    Posts
    875
    Rep Power
    275
    1. where did PEAR get installed?

    2. just installing PEAR won't fix your problem ..you still need to install the PEAR::Mail pkg.

    **It would have been much simpler if you would have just used PHPMailer instead.
  24. #13
  25. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    11
    Rep Power
    0
    I think i have install pear only ...i hav'nt install pear ::Mail pkg..can you assist me how to install pear::Mail pkg on hosting server ..?
  26. #14
  27. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Location
    Nebraska, USA
    Posts
    875
    Rep Power
    275
    if you used the go-pear.php method to install as described from your "godaddy" link, then, you should have gotten an index.php file which is to be used as your "PEAR admin frontend " for configuring your PEAR install [including installing other packages].

    If you can access that file correctly, you will need to scroll down to bottom of that page ["index.php"] and there you can install individual pkgs.

    the PEAR pkgs that you will need to install to get your mail script functioning are: Mail, Net_SMTP, and Auth_SASL

    I'm not familliar with GoDaddy's setup, so, that is as much help as I can give you on this subject.

    **I will say one more time, though, that this would be much easier if you would just use PHPMailer script. You copy 2 files and perform small rewrite of your mailing script and you're done.[other than validating inputs]**
  28. #15
  29. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    11
    Rep Power
    0
    can u tell me how to install Mail, Net_SMTP, and Auth_SASL package.
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo