problem: mail() with subdomain in TO address

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bobby Ray

    problem: mail() with subdomain in TO address

    Hi PHP People,

    When using mail() with a TO address that includes a subdomain, as in
    foo@sub.domain. com, the intended recipient never receives the mail.

    I'm not sure if this is a problem with mail() or a misconfiguratio n of
    the mail program (postfix on dev server, qmail on production server),
    but foo@sub.domain. com doesn't receive any mail, while foo@domain.com
    gets it every time.

    Any thoughts will be greatly appreciated!

    echo 'mail() test - WITHOUT SUBDOMAIN<br />';
    // this works fine
    mail(
    'foo@domain.com ',
    'this is the subject',
    'this is the message',
    "From: bar@domain.com\r\n"
    );

    echo 'mail() test - WITH SUBDOMAIN';
    // this doesn't work
    mail(
    'foo@sub.domain .com',
    'this is the subject',
    'this is the message',
    "From: bar@domain.com\r\n"
    );
  • Pedro Graca

    #2
    Re: problem: mail() with subdomain in TO address

    Bobby Ray wrote:[color=blue]
    > When using mail() with a TO address that includes a subdomain, as in
    > foo@sub.domain. com, the intended recipient never receives the mail.
    >
    > I'm not sure if this is a problem with mail() or a misconfiguratio n of
    > the mail program (postfix on dev server, qmail on production server),
    > but foo@sub.domain. com doesn't receive any mail, while foo@domain.com
    > gets it every time.
    >
    > Any thoughts will be greatly appreciated![/color]


    Probably the mail configuration for "domain.com " and "sub.domain.com "
    doesn't allow it.



    $ host -tmx domain.com
    domain.com mail is handled by 10 mail.domain.com .

    $ host -tmx sub.domain.com
    Host sub.domain.com not found: 3(NXDOMAIN)

    --
    USENET would be a better place if everybody read: | to email me: use |
    http://www.catb.org/~esr/faqs/smart-questions.html | my name in "To:" |
    http://www.netmeister.org/news/learn2quote2.html | header, textonly |
    http://www.expita.com/nomime.html | no attachments. |

    Comment

    • Bobby Ray

      #3
      Re: problem: mail() with subdomain in TO address

      Pedro Graca wrote:[color=blue]
      >
      > Probably the mail configuration for "domain.com " and "sub.domain.com "
      > doesn't allow it.
      >
      > $ host -tmx domain.com
      > domain.com mail is handled by 10 mail.domain.com .
      >
      > $ host -tmx sub.domain.com
      > Host sub.domain.com not found: 3(NXDOMAIN)[/color]

      Dear Pedro,

      Thanks for the suggestion.

      In my php script the address with the subdomain never changes. It's a
      good address with nice MX records to make it go. It works every time
      I send something to it from win98/Outlook Express, but it doesn't "go"
      when I use it as the TO address with mail() in a PHP page on a couple
      Linux servers, one using qmail, the other using postfix.

      Any other suggestions?

      Best wishes,

      Bobby

      Comment

      • Pedro Graca

        #4
        Re: problem: mail() with subdomain in TO address

        Bobby Ray wrote:[color=blue]
        > In my php script the address with the subdomain never changes. It's a
        > good address with nice MX records to make it go. It works every time
        > I send something to it from win98/Outlook Express, but it doesn't "go"
        > when I use it as the TO address with mail() in a PHP page on a couple
        > Linux servers, one using qmail, the other using postfix.
        >
        > Any other suggestions?[/color]

        When you examine the full headers of messages received on "domain.com "
        and "sub.domain.com " do you notice anything peculiar?


        Can you telnet to the mail server and look at its messages?

        pedro$ telnet domain.com 25
        < Trying [IP.ADDRESS]...
        < Connected to domain.com.
        < Escape character is '^]'.
        < 220 Ready
        MAIL FROM: <hexkid@hotpop. com>
        < 250 Ok
        RCPT TO: user@mail.domai n.com
        < 250 Ok
        DATA
        < 354 End data with <CR><LF>.<CR><L F>
        body

        Comment

        Working...