Mail server settings in PHP

Discussion in 'PHP and MySQL' started by QCSitter, Jan 4, 2011.

  1. QCSitter

    QCSitter Guppy

    My php site is trying to send a simple email but I'm getting the following error:

    Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\hshome\qcsitter\qcsitter.com\newsletter.php on line 86

    I believe the php.ini for my domain needs to be modified by the JodoHost team with the right settings. Do I have access to this file through the CP or must the support team take care of it for me?
  2. Stephen

    Stephen US Operations Staff Member

    it would be best to use ini_set to point to your mail server for proper SMTP Auth mail.
    As I remember it you are on w2k8 server where we are not able to provide custom php.ini to this point, and we edited the global ini for your mysql connection.
  3. QCSitter

    QCSitter Guppy

    Yes, that was me and I really appreciate you changing that setting for me as it is working great now! However, my application cannot send email because there is no localhost smtp service and I can't use mail.qcsitter.com because PHP on IIS doesn't support authentication using the native php mail() function.

    That is, I'm unable to authenticate using ini_set as smtp auth isn't supported on IIS. There are two options that can be had from here though:

    1. Modify the php.ini to my mail server settings (or your own) and tell the mail server to allow relay from my domain locally (something you'd have to do Stephen).

    or

    2. I could try to use Pear's functionality in PHP and I see that you've included Pear in the PHP setup but I'm unsure if it will function as I need.

    Is option 1 a possibilty Stephen? Thanks for your help.
  4. QCSitter

    QCSitter Guppy

    Update: I created a test script quick to try to use Pear and it failed to find Mail.php which would be in the Pear directory. So looks like both will have to be handled on your side to resolve this.
  5. Stephen

    Stephen US Operations Staff Member

    I will check it, about local SMTP, it is actually on and set to allow relay, so it may be attempting to go through the firewall in some manner, I'll check that log, but it should not do this.

    As for two, I'll work on pear libs, they are needed certainly, which version of php are you using I remember working on the matter but was trying for php4 and 5, I will need to do the same here, but you can confirm if one works.

    Actually PEAR libs can be referenced from another path, since just classes, they don't require a server side install. However I'll work to make it a little easier if possible.
  6. QCSitter

    QCSitter Guppy

    I'm using PHP v5. Just let me know what you want me to do and I'll do it. Thanks for looking into this!
  7. Stephen

    Stephen US Operations Staff Member

    I think your app should be able to use localhost now, let me know if any issue continues.
  8. QCSitter

    QCSitter Guppy

    Stephen:

    It is now working perfectly. Thank you for resolving the issue!

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services