Requesting Help in PHP mail

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tamilmani
Forum Commoner
Posts: 39
Joined: Tue Apr 01, 2008 2:53 am

Requesting Help in PHP mail

Post by tamilmani »

Hi ,

My issue:- How to send the email to subdomain email address?

Example:- tamilmani@subdomain.subdomain.com

If i validate the email id , am able to see valid email message. But email is not sending to subdomain email address. Is there any solution for this issue?

Please any one give me the solution for this issue?

Thanks
Tamilmani Mohan
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Requesting Help in PHP mail

Post by twinedev »

What happens if you manually send e-mail to it from a regular e-mail client?
tamilmani
Forum Commoner
Posts: 39
Joined: Tue Apr 01, 2008 2:53 am

Re: Requesting Help in PHP mail

Post by tamilmani »

There is no issues in that. If i send email from email client . I am able to receive the email. But by using php , i am not able to receive the email.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Requesting Help in PHP mail

Post by twinedev »

what code are you using to send it. Is the domain on same server you are trying to send it form, perhaps DNS not set up right for it on the server.
tamilmani
Forum Commoner
Posts: 39
Joined: Tue Apr 01, 2008 2:53 am

Re: Requesting Help in PHP mail

Post by tamilmani »

I am using simple PHP code.

<?php
$email ="mohantamilmani@gmail.com";
$subject = "Testing Email From Server";
$message = "This is tamilmani mohan. I am testing the mail";
mail("tamilmani@domain.sudomain.com", "Subject: $subject",$message, "From: $email" );
echo "Thank you for using our mail form";
?>

Is there any problem in above code?

If i replace the tamilmani@domain.sudomain.com to tamilmani@domain.com(ex:- tamilmani@gmail.com like) => It will work.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Requesting Help in PHP mail

Post by twinedev »

Nope, don't see anything wrong with it (well functionality wise anyhow).

From there I would check to make sure the server is configured to handle the domain. (ie. you have the domain wet for web pages to go to that server, yet e-mail actually goes to another service, the server may think mail should be delivered on the server and therefore never send out).

-Greg
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Requesting Help in PHP mail

Post by Christopher »

tamilmani wrote:Hi ,

My issue:- How to send the email to subdomain email address?

Example:- tamilmani@subdomain.subdomain.com
Do you have MX records for the sub-domain?
(#10850)
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Requesting Help in PHP mail

Post by twinedev »

Christopher wrote:Do you have MX records for the sub-domain?
It was already mentioned that sending e-mail directly from e-mail client delivers properly.

I still leaning to that the subdomain was set up to be on the server running the PHP script, but the domain is actually set for mail to be handled elsewhere, and that the web server thinks it handles the email so it never leaves to make it out to the actual mail server.

-Greg
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Requesting Help in PHP mail

Post by Christopher »

tamilmani may need to set the hosts file on the server with entries to let the mail system know where to send the mail.
(#10850)
Post Reply