The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Having problems with SMTP Tweak

Discussion in 'E-mail Discussions' started by A1Elements, May 17, 2010.

  1. A1Elements

    A1Elements Member

    Joined:
    May 17, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    I've a simple PHP script that sends the data entered on my 'contact us' page to my email address, when people pressing the submit button, this is what they receive:

    Warning: fsockopen() [function.fsockopen]: unable to connect to mywebsite.com:25 (Connection refused) in /home/username/public_html/MailConfigure.php on line 137

    I've tried disabling SMTP Tweak and it fixed the issue, but after a day this error occurs again and I need to enable/disable SMTP Tweak each time to get it back to work.
    Any Ideas/suggestion would really appreciated,...:eek:
     
  2. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    From what you just said, it sounds like you have a really crappy script because it is using fsockopen() to directly act as it's own mail server instead of either using the PHP mail() functions or calls to the system SMTP which is a very major problem in more ways that one.

    Allowing scripts to function this way is a major security risk and yes that is why you have to disable your "SMTP Tweak" because that is precisely what that function was meant to stop scripts from doing!

    The first thing I would do is either replace the script or rewrite it so that the script makes proper mail calls instead of trying to make it's own direct network connections. :rolleyes:

    I would be glad to give you a helping hand with that ...

    Second thing to do is take a hard look at your security because if you are using "SMTP Tweak" and it is actually working that would suggest to me you either don't have CSF/LFD or APF/BFD firewalls or they aren't configured properly as both have functions that would superceed SMTP Tweak built into Cpanel which is what you would want to use in the absence of something better. Overall this suggests to me that the rest of your security situation might possibly be inadequate.
     
  3. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Most PHP scripts have different options for sending mail. I recommend switching it to "sendmail" or "mail()."
     
  4. A1Elements

    A1Elements Member

    Joined:
    May 17, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for your help, specially you "Spiral" :D and sorry for posting in wrong place.
    I'm working with a friend to fix the code but maybe I would need more assistance :rolleyes:
     
  5. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    You are welcome. If that is a a custom script you wrote, you will find the internal mail() function in PHP much simpler and can probably knock out about half of your entire script code verses using fsockopen() for that! ;)
     
Loading...

Share This Page