Not getting submitted emails from forms

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

waydawn
Forum Newbie
Posts: 4
Joined: Fri Oct 14, 2005 11:48 am
Location: arizona

Not getting submitted emails from forms

Post by waydawn »

Howdy all!!
I am kinda frustrated here, ever since I went thru 2 form maker packages and was able to create forms, I was having the problem of not recieving my submitted emails back to my pc email on both. Funny thing is i tried using my msn email, yahoo email also beside my standard email, I noticed that yahoo email works but my 2 others don't. So my host whom I have webspace thru has told me since yahoo works that means thier server side emails are functioning. Personally I feel there is something else there. Anyone have any idea what to do? I even used my homepage email addie which redirects it back to my standard email, nothing......sigh. :(
User avatar
hanji
Forum Commoner
Posts: 46
Joined: Fri Apr 29, 2005 3:23 pm

Post by hanji »

So... If I understand your post correctly.

1. You have a contact form that is sending you emails directly upon submission.
2. You only receive emails if they are sent to you yahoo account. So if you set it to send to your MSN account, they do not reach you?

This could be due to a couple of things.. here are my ideas.

1. The site that the application is hosted on, which is sending the mail, may be on a blacklist. Please verify that with the following...

http://www.ordb.org
http://www.spamhaus.org/sbl/index.lasso
http://www.spamhaus.org/xbl/index.lasso
http://njabl.org/lookup.html

If you server is on a 'blacklist' some mailservers will not accept mail for delivery from them.

2. You have a misconfiguration in your headers. Sending malformed headers could be blocked from certain mailservers.

Could you include your header values? Also, do you receive bounce backs of any kind. Is the reply or from an email that you receive? If you don't receive email bounces.. they may be bouncing back to apache. Maybe worth talking with you host to see if they're seeing any bounce back.. or bounce back messages in their mail.logs.

Hope this helps
hanji
waydawn
Forum Newbie
Posts: 4
Joined: Fri Oct 14, 2005 11:48 am
Location: arizona

Post by waydawn »

Hanji:
Thanks so much for your input i will look into it, and go from there.
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

hanji wrote:they may be bouncing back to apache.
How? Apache is a web server not a mail server.
User avatar
hanji
Forum Commoner
Posts: 46
Joined: Fri Apr 29, 2005 3:23 pm

Post by hanji »

That is correct.. Apache is a webserver and not a mailserver.

But the web application (ie:apache) is sending the mail. If you don't specifiy envelope-sender in your headers.. it'll bounce back to apache@localhost or apache@fqdn... since that is the user that sent the mail.

Here is a snippet from mail.log while executing a mail script

Code: Select all

Oct 15 11:49:48 localhost postfix/pickup[30018]: 760CA8F8D9A: uid=81 from=<apache>
Oct 15 11:49:48 localhost postfix/cleanup[30289]: 760CA8F8D9A: message-id=<20051015174948.760CA8F8D9A@localhost>
Oct 15 11:49:48 localhost postfix/qmgr[8681]: 760CA8F8D9A: from=<apache@localhost>, size=451, nrcpt=1 (queue active)
Oct 15 11:49:52 localhost postfix/smtp[30291]: 760CA8F8D9A: to=<testuser@cox.net>, relay=testserver.cox.net[xxx.xxx.xxx.xxx], delay=4, status=sent (250 Message received: 20051015175137.FGWN7222.testserverxi07.cox.net@localhost)
Oct 15 11:49:52 localhost postfix/qmgr[8681]: 760CA8F8D9A: removed
If that would bounce.. it would bounce to apache.. and drop the email to /home/httpd/.maildir/new depending on your server configuration. You can also verify this by looking at the full message headers. Again.. unless you set the envelope-sender to be other than apache (which is not default behaviour with php/ mail()/ sendmail) it will be sent from apache.

Thanks
hanji
User avatar
hanji
Forum Commoner
Posts: 46
Joined: Fri Apr 29, 2005 3:23 pm

Post by hanji »

Here is an example message header from an email sent from a web application:

Code: Select all

Return-Path: <apache@hanji.xxxx.com>
X-Original-To: admin@xxxx.com
Delivered-To: admin@xxxx.com
Received: by hanji.xxxx.com (Postfix, from userid 81)
	id A460E65407C; Mon, 10 Oct 2005 23:52:02 -0600 (MDT)
To: admin@xxxxx.com
Subject: My Test Mail
From: admin@xxxxx.com
Content-Type: text/plain;
	charset="iso-8859-1"
Message-Id: <20051011055202.A460E65407C@hanji.xxxx.com>
Date: Mon, 10 Oct 2005 23:52:02 -0600 (MDT)

Notice the "Return-Path". You can change that if you add envelope-sender value in the header.. but it defaults to apache. Bounces would go to return-path.

hanji
waydawn
Forum Newbie
Posts: 4
Joined: Fri Oct 14, 2005 11:48 am
Location: arizona

Post by waydawn »

I found out, Cox now tells me if I get a business account they will unblock port 25, what jerks they are
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

hanji wrote:That is correct.. Apache is a webserver and not a mailserver.

But the web application (ie:apache) is sending the mail. If you don't specifiy envelope-sender in your headers.. it'll bounce back to apache@localhost or apache@fqdn... since that is the user that sent the mail.
Rubbish! Apache sends the mail to the local mailserver for onward processing. If it is not rejected at that time then Apache will not know.
User avatar
hanji
Forum Commoner
Posts: 46
Joined: Fri Apr 29, 2005 3:23 pm

Post by hanji »

Rubbish!
Now now.. no need to be rude.
Apache sends the mail to the local mailserver for onward processing.
Ok.. that is correct.
If it is not rejected at that time then Apache will not know.
If it is not rejected.. (meaning it's valid)... then Apache will not know (yeah.. because it's good)

What I'm saying...

If it IS rejected.. Apache WILL know. Otherwise where will the bounce go? If you don't set the Return-Path (which is not default in mail().. then where does it go???

Here are couple of links describing the issue:
http://forums.quadrahosting.com.au/showthread.php?t=462 => clearly describes the 'Return-Path' issue.
http://www.webmasterworld.com/forum88/8843.htm

If you don't add the '-f' flag in the headers (envelope-sender) the return path will be apache or some other service.. not the 'from' value.

hanji
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

hanji wrote:If it IS rejected.. Apache WILL know. Otherwise where will the bounce go?
That is the whole point; if it is rejected there is no bounce. A bounce only happens if a mail is first accepted and then later rejected by the remote mailserver. This is something Apache will never know about.
User avatar
hanji
Forum Commoner
Posts: 46
Joined: Fri Apr 29, 2005 3:23 pm

Post by hanji »

I thought I'd put a proof of concept together:

Code: Select all

<?
$Email          = "bouncy@bounce.com";
$to                     = $Email;
$subject        = "TEST SCRIPT";
$message        = "Message: test";
$headers        = "MIME-Version: 1.0\r\n";
$headers        .= "From:test@rulz.com\r\n";
$headers        .= "Content-Type: text/plain;\n\tcharset=\"iso-8859-1\"\n";
mail($to, $subject, $message, $headers);
echo "DONE";
?>
I execute the script.. gave me a "DONE"... Okay.. now to check the mail.log

Code: Select all

Oct 15 15:40:27 localhost postfix/pickup[30978]: E1A72B17D45: uid=81 from=<apache>
Oct 15 15:40:27 localhost postfix/cleanup[31422]: E1A72B17D45: message-id=<20051015214027.E1A72B17D45@localhost.xxxxxx.com>
Oct 15 15:40:27 localhost postfix/qmgr[8681]: E1A72B17D45: from=<apache@xxxxxx.com>, size=394, nrcpt=1 (queue active)
Oct 15 15:40:34 localhost postfix/smtp[31424]: E1A72B17D45: to=<bouncy@bounce.com>, relay=mailhost.bounce.com[61.121.253.169], delay=7, status=bounced (host mailhost.bounce.com[61.121.253.169] said: 550 5.1.1 <bouncy@bounce.com>... User unknown (in reply to RCPT TO command))
Oct 15 15:40:35 localhost postfix/cleanup[31422]: 2D751B17D46: message-id=<20051015214035.2D751B17D46@localhost.xxxxxx.com>
Oct 15 15:40:35 localhost postfix/qmgr[8681]: E1A72B17D45: removed
Oct 15 15:40:35 localhost postfix/qmgr[8681]: 2D751B17D46: from=<>, size=2330, nrcpt=1 (queue active)
Oct 15 15:40:35 localhost postfix/local[31426]: 2D751B17D46: to=<apache@xxxxxx.com>, relay=local, delay=0, status=sent (delivered to command: /usr/bin/procmail)
Oct 15 15:40:35 localhost postfix/qmgr[8681]: 2D751B17D46: removed
Okay.. got a User unknown from PostFix... Now I wonder if Apache will know about this...

Code: Select all

hanji new # ls -al /home/httpd/.maildir/new
total 4
drwxrwxrwx  2 apache root     88 Oct 15 15:40 .
drwxrwxrwx  5 apache root    120 Feb 25  2004 ..
-rw-------  1 apache apache 2355 Oct 15 15:40 1129412435.31427_0.hanji
Weird.. apache got a new mail?? I bet it's the bounce!

Code: Select all

Return-Path: <>
X-Original-To: apache@xxxxx.com
Delivered-To: apache@xxxxx.com
Received: by localhost.xxxxx.com (Postfix)
        id 2D751B17D46; Sat, 15 Oct 2005 15:40:35 -0600 (MDT)
Date: Sat, 15 Oct 2005 15:40:35 -0600 (MDT)
From: MAILER-DAEMON@xxxxx.com (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: apache@xxxxx.com
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
        boundary="E1A72B17D45.1129412435/localhost.xxxxx.com"
Message-Id: <20051015214035.2D751B17D46@localhost.xxxxx.com>

This is a MIME-encapsulated message.

--E1A72B17D45.1129412435/localhost.xxxxx.com
Content-Description: Notification
Content-Type: text/plain

This is the Postfix program at host localhost.xxxxx.com.

I'm sorry to have to inform you that your message could not be
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to <postmaster>

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                        The Postfix program

<bouncy@bounce.com>: host mailhost.bounce.com[61.121.253.169] said: 550 5.1.1
    <bouncy@bounce.com>... User unknown (in reply to RCPT TO command)

--E1A72B17D45.1129412435/localhost.xxxxx.com
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; localhost.xxxxx.com
X-Postfix-Queue-ID: E1A72B17D45
X-Postfix-Sender: rfc822; apache@xxxxx.com
Arrival-Date: Sat, 15 Oct 2005 15:40:27 -0600 (MDT)

Final-Recipient: rfc822; bouncy@bounce.com
Action: failed
Status: 5.0.0
Diagnostic-Code: X-Postfix; host mailhost.bounce.com[61.121.253.169] said: 550
    5.1.1 <bouncy@bounce.com>... User unknown (in reply to RCPT TO command)

--E1A72B17D45.1129412435/localhost.xxxxx.com
Content-Description: Undelivered Message
Content-Type: message/rfc822

Received: by localhost.xxxxx.com (Postfix, from userid 81)
        id E1A72B17D45; Sat, 15 Oct 2005 15:40:27 -0600 (MDT)
To: bouncy@bounce.com
Subject: TEST SCRIPT
MIME-Version: 1.0
From: test@rulz.com
Content-Type: text/plain;
        charset="iso-8859-1"
Message-Id: <20051015214027.E1A72B17D45@localhost.xxxxx.com>
Date: Sat, 15 Oct 2005 15:40:27 -0600 (MDT)

Message: test

--E1A72B17D45.1129412435/localhost.xxxxx.com--
hanji
waydawn
Forum Newbie
Posts: 4
Joined: Fri Oct 14, 2005 11:48 am
Location: arizona

Bouncers

Post by waydawn »

I used to be a "Bouncer" but nothing this complex................
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

Thanks for making me laugh. Ha Ha. This: apache@xxxxx.com is just a mailbox. It's not apache. Here's another one for you:
the.queen.of.england@myDomain.com
It doesn't make me the Queen odf England now does it?
User avatar
hanji
Forum Commoner
Posts: 46
Joined: Fri Apr 29, 2005 3:23 pm

Post by hanji »

This thread is getting too old... and boring. I've provided my argument(s). I've provided my proof of concept(s). You can take it or leave it. You haven't shown me anything.
This: apache@xxxxx.com is just a mailbox. It's not apache
You have a serious lack of understanding. Did you not see that apache is the USER. Apache's mailbox was located at /home/httpd/.maildir/new, and that is where that mail was dropped. Did you see the permissions on that directory being owned by apache:apache?? It's not just some virtual mail account.

Okay.. so again, I'll try to make another proof of concept. I've deleted /home/httpd. That is deleting Apache User's home directory. So his 'mailbox' is gone. I'll execute the script again....

Also.. I thought I'd show you apache's account info.. in case that was confusing you.

Code: Select all

apache:x:81:81:apache:/home/httpd:/bin/false

Code: Select all

Oct 15 16:08:51 localhost postfix/local[31563]: 3D4ABB17E14: to=<apache@mydomaindude>, relay=local, delay=72, status=bounced (can't create user output file. Command output: procmail: Unable to treat as directory "/home/httpd/.maildir" procmail: Couldn't create "/home/httpd/.maildir" procmail: Unable to treat as directory "/home/httpd/.maildir" procmail: Lock failure on "/home/httpd/.maildir.lock" procmail: Error while writing to "/home/httpd/.maildir" )
Oct 15 16:08:51 localhost postfix/qmgr[8681]: 3D4ABB17E14: removed
Now the interesting part.. is that now postfix/procmail are trying to drop mail to apache's home directory.. but it can't, cos it's not there. Also.. since you still don't seem to get it.. I'm sending the mail TO 'bouncey@bounce.com' FROM 'test@rulz.com'. Why is apache in the mix? Why is the bounce trying to go to apache's home dir?

hanji
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

Ok, so the mailbox is located in apache's home directory... So what... That does not make apache a mailserver.

Here is my argument: Try connecting to apache on port 25 and see if you get a 220 response. If you don't or the response is not from apache then your arguments are down the toilet.
Post Reply