Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 11 of 11
  1. #1
    Member
    Join Date
    Oct 2008
    Posts
    38

    Default PHP email - not able to send externally

    I'm having a problem with PHP email not sending externally, if the recepitant email is a local domain the email will be delivered without any problems but if put an external email address with a domain not on the server the email never seems to get there.

    On the Tweak Setting it is already Unchecked for the "Prevent the user "nobody" from sending out mail to remote addresses" option.

    I am also using suphp as the PHP5 handler.

    I can't seem to figure this out, any ideas?

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Many mail providers (including many using cPanel/WHM) now perform sender verification on mail coming into their server from an external server to ensure the 'from' address on an email is an actual email address. If this is not an actual email address, it is discarded as spam. So make sure the 'from' is an actual email address.

    There is also common speculation that a PHP script sending mail via SMTP is a better method of sending mail than relying on PHP's mail() function. In many contemporary distributed PHP scripts, all one has to do is change a few settings to switch from using mail() to using SMTP.

  3. #3
    Member
    Join Date
    Oct 2008
    Posts
    38

    Default

    I dont think that is the issue in this case, I have access to the other server in which I am trying to send the email to. There is a special account on there where all spam gets dumped into I don't see any of the emails in there. After I try to send the email with the script it appears to work fine, no error notice or anything but it just never shows up at the other remote email. However when sending to a local email on the server it shows up fine.

  4. #4
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by zerokarma View Post
    I dont think that is the issue in this case, I have access to the other server in which I am trying to send the email to. There is a special account on there where all spam gets dumped into I don't see any of the emails in there. After I try to send the email with the script it appears to work fine, no error notice or anything but it just never shows up at the other remote email. However when sending to a local email on the server it shows up fine.
    And it is only email from the script, not other email from your server, that is disappearing?

  5. #5
    Member
    Join Date
    Oct 2008
    Posts
    38

    Default

    I believe its just the script/php mail

    All the other mail seems to be perfectly fine sending remotely

    One thing I did try was creating a forwarding email address that would send to the remote email. When I sent a test email to this forwarding email address it worked fine and I received the mail.

    When I set the script to send the email to this forwarding email the email still never arrives at the remote email.

  6. #6
    Member
    Join Date
    Oct 2008
    Posts
    38

    Default

    OK i was checking for errors and didn't find any intially but then found this:

    1 - s97_9stealth8_46@stealthcomputer.com R=lookuphost T=remote_smtp: SMTP error from remote mail server after MAIL FROM:<nobody@srv2.stealth.com> SIZE=2043: host mail.stealthcomputer.com [207.44.176.68]: 553 5.1.8 <nobody@srv2.stealth.com>... Domain of sender address nobody@srv2.stealth.com does not exist
    What should I do to correct it?

  7. #7
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by zerokarma View Post
    OK i was checking for errors and didn't find any intially but then found this:



    What should I do to correct it?
    Have it send mail with a from address of a valid email address on your server rather than sending it as "nobody@srv2.stealth.com"

    You may wish to consider using SMTP to send the mail if you are not sufficiently familiar with the PHP mail() function to do this.

  8. #8
    Member
    Join Date
    Oct 2008
    Posts
    38

    Default

    Quote Originally Posted by cPanelDavidG View Post
    Have it send mail with a from address of a valid email address on your server rather than sending it as "nobody@srv2.stealth.com"

    You may wish to consider using SMTP to send the mail if you are not sufficiently familiar with the PHP mail() function to do this.
    How do you change it from sending as "nobody@srv2.stealth.com"? Is it done at the script level or elsewhere?

    How do you set PHP to send my SMTP? again is it at the script level or elsewhere?

  9. #9
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by zerokarma View Post
    How do you change it from sending as "nobody@srv2.stealth.com"? Is it done at the script level or elsewhere?
    Short answer: the script level.

    Long answer: you can have it be user@srv2.stealth.com (where user is their cPanel username) by using SuPHP since this will force scripts to execute as the user rather than user nobody.

    Quote Originally Posted by zerokarma View Post
    How do you set PHP to send my SMTP? again is it at the script level or elsewhere?
    This is handled on the script level.

  10. #10
    Member
    Join Date
    Aug 2002
    Posts
    1,120

    Default

    In your PHP script when you call the mail() function, make use of the fifth parameter of PHP's mail function:

    http://us3.php.net/manual/en/function.mail.php

    PHP Code:
    mail($to$subject$message$headers"-fsomerealaddress@example.com"); 
    The somerealaddress@example.com address is the address that you want bounced return messages to come to. It needs to be a valid e-mail address, one that actually accepts mail.

  11. #11
    Member
    Join Date
    Oct 2008
    Posts
    38

    Default

    Thanks I will try that

Similar Threads & Tags
Similar threads

  1. Turn off Exim and SA when hosting email externally?
    By meeven in forum E-mail Discussions
    Replies: 1
    Last Post: 10-28-2008, 04:45 AM
  2. Parked domains do not receive email externally
    By cytexone in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 07-31-2007, 11:14 AM
  3. Setting up email filtering for externally hosted domains?
    By meeven in forum E-mail Discussions
    Replies: 3
    Last Post: 07-20-2007, 08:23 AM
  4. Problem with mailform when dns/email is located externally
    By torkil in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 09-12-2006, 11:38 AM
  5. externally (remotely) adding email addresses.
    By CaspianHost in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-28-2002, 01:02 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube