By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,949 Members | 1,855 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,949 IT Pros & Developers. It's quick & easy.

problem: mail() with subdomain in TO address

P: n/a
Hi PHP People,

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

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

Any thoughts will be greatly appreciated!

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

echo 'mail() test - WITH SUBDOMAIN';
// this doesn't work
mail(
'fo*@sub.domain.com',
'this is the subject',
'this is the message',
"From: ba*@domain.com\r\n"
);
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Bobby Ray wrote:
When using mail() with a TO address that includes a subdomain, as in
fo*@sub.domain.com, the intended recipient never receives the mail.

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

Any thoughts will be greatly appreciated!

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. |
Jul 17 '05 #2

P: n/a
Pedro Graca wrote:

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)


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
Jul 17 '05 #3

P: n/a
Bobby Ray wrote:
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?


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: <he****@hotpop.com>
< 250 Ok
RCPT TO: us**@mail.domain.com
< 250 Ok
DATA
< 354 End data with <CR><LF>.<CR><LF>
body
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.