Log in

View Full Version : A new contact form


Jason Dunn
07-20-2002, 10:00 AM
<a href="http://www.pocketpcthoughts.com/contact.php">http://www.pocketpcthoughts.com/contact.php</a><br /><br />Not the most exciting thing I've ever announced, but we now have a new contact form. It will hopefully cut down on the amount of spam we get to the news@ alias, since most spam harvesters don't scan HTML code (I hope). You can keep using news@ in your email, but I hope that people who have always wondered how to submit Pocket PC news will find this easier than ever (and you can submit news anonymously). Nothing special on the form, but you can pick who you want the message to go to - the entire team, individual members, etc. We've actively removed all our email addresses off the site - this form is your single point of contact if you don't already have our email addresses in your address book. <img src="http://www.pocketpcthoughts.com/forums/images/smiles/icon_wink.gif" /><br /><br />It's all nicely done in PHP, with special thanks to the second of my PHP Samurai, Elad Yakobowicz (a.k.a. EmXtrix). I've been meaning to create a nice contact form for quite some time, but other matters always seemed more importance. Elad asked me if he could help, and help me he did! Thanks Elad!<br /><br />There is one problem with it, however. It seems that 50% of the time, it's incredibly slow, taking 30+ seconds to process. The email always gets sent, but the other 50% of the time it takes half a second to process. Everyone helping me with this is totally stumped, and I need someone who knows a lot about Linux server administration to take a look at our server configuration - we're clearly not doing something correct.

Elad Yakobowicz
07-20-2002, 01:04 PM
Wow, me - a PHP Samurai, who would have thought! :P

Just wanted to drop by and say hello. Enjoy the contact form, everyone! :flasingsmile:

/dev/niall
07-20-2002, 07:27 PM
Is sendmail doing a reverse DNS lookup that may take a long time? Mucking around with ident?

Sendmail will look up the MX record of any host you send mail to; regardless of whether or not it is in the /etc/hosts file. Your bottleneck may be your DNS server.

You could test this out quite easily by setting up a caching name server on your box so the requests are handled more quickly.

Or you could configure sendmail to just relay all the mail to a smart host who would actually send the mail. If sendmail knows it's always going to forward the mail on to someone else it won't bother with the lookups.

Is sendmail configured to send the mail immediatly? You could try telling it to process the queue every 5 minutes or so. I think it would try the lookup when the queue is processed and not when the mail is submitted to be sent.

[pause for a google search]

There's actually a pretty decent page on Linux Gazette that may be helpful:

http://www.linuxgazette.com/issue31/tag_maildns.html

and

http://www.linuxgazette.com/issue36/tag/20.html

Pretty much says what I just said except it goes into more detail on possible solutions. ;)

Hope this helps! Dealing with sendmail can be nasty.

Jason Dunn
07-20-2002, 11:27 PM
Thanks for the tips - we'll look into it!

njb42
07-22-2002, 04:26 AM
(Note: I am also assuming that you use sendmail, although I do not see that stated explicitly. If you're using Postfix or qmail, the same principles would probably still apply, but YMMV.)

I would definitely second the suggestion that you check your sendmail configuration for reverse-DNS lookups. These can take a long time, especially if the user is on a dialup or DSL account configured with DHCP or RADIUS. Not all ISP's take the time to create IN PTR DNS records for every single address in their dialup pool.

The problem may also lie in the way you're calling sendmail. If you submit messages into the sendmail queue using /sbin/sendmail, the program should return immediately -- the DNS lookups are done by the daemon when it processes the queue. Most CGI scripts call sendmail as an external process this way.

If your script is in fact opening a connection to port 25 instead of invoking /sbin/sendmail, then these delays are more likely the cause of DNS problems. Note also that sendmail may perform an MX lookup to see if it is authoritative to accept the incoming message. If there is some misconfiguration in your DNS server, or if the mail and DNS servers are separated by a few hops on the network, this could also cause the problem.

If you need help with sendmail, I can try to pitch in. I've done a fair amount of work with it. I've also been a Linux geek for about 11 years. :twisted:

Madoc Owain
07-22-2002, 02:46 PM
Unfortunately, it's been my experience that spam harvesters DO scan HTML code, at least to look for "mailto:" tags. I don't have enough of a readership to explain it by saying it's people getting the address "by hand" and submitting it to spammers. http://www.madocowain.com

M.O.

njb42
07-24-2002, 10:36 PM
Oh, spammers definitely scan HTML for mailto: links or anything that looks like a valid SMTP address. Often they use web spiders that masquerade their USER-AGENT strings to look like MSIE or Netscape so you won't suspect you're being harvested.

There are numerous stories over at slashdot.org if anyone's interested.