Advertise here: Contact FM.


Who's got mail? That is the Question.
January 5, 2006 2:29 PM   RSS feed for this thread Subscribe

We're trying to build a web based, semi-automated careers referral program on the company website. We'd like employees to send specific job postings to friends via our website. Due to anti-spam circumventions in formmail and other such programs, this is proving difficult. What CGI/PHP tools would you recommend?

The basic idea is this; an employee enters their friend's email and their own in a form on our company website. When they hit submit a personalized invitation to visit our careers section is sent to their friend.

e.g.
"Hi Bill,

Did you know we've got a lot of nice job postings on our site? You should check them out.

Your friend, Bob"


Back in the day I'd have used FormMail to handle this but thanks to spammers I can't use FormMail to send to an unverified email address. How do I automate this funciton on our site without opening our SendMail up to spammers while keeping with the personalization of receiving job postings from friends that we want to keep?
posted by DragonBoy to computers & internet (7 comments total)
PHP has a standard mail() function which should handle it. The only caveat is if you intend to make the user's email address the FROM: line in the email. In that case, you'll need to ensure that your web server is in the same domain/IP address range as the rDNS or PTR record for your domain name's mail server.

For example: mail.mydomain.com has an rDNS to 192.168.1.1. If www.mydomain.com is the server from which you'll be sending this scripted email, and the from address is bill@mydomain.com, and the rDNS of www.domain.com resides within the same registered IP range as mail.mydomain.com -- you should have no problem sending to ISP recipients like AOL.com and RR.com (who happen to do serious verification of the From line in emails sent to their users).

Other than that concern, you should be fine sending said email directly from PHP's mail() function without worries of spam filtering.
posted by thanotopsis at 2:45 PM on January 5, 2006


Using perl you can write a simple direct mail delivery function that connects directly to the recipient's mail server and delivers mail directly. This way you don't need to rely your mail server software (sendmail, exim, whatever) or rely on 3rd party mail relays.

Your perl code would have two parts: lookup the MX host then deliver the message to that host like so:

In perl, extract the target domain from the target email address (everything after the @) then feed that domain name into perl's Net::DNS module to figure out the MX host, that will tell you the target mail server address you should connect to.

Then use perl's Net::SMTP module to connect directly to that mail server and place email directly on the server.
posted by StarForce5 at 3:25 PM on January 5, 2006


Another way to do it is to use the PEAR::SMTP module to send mail directly from your corporate mail server... that will keep email from being checked as harshly.

Just keep in mind that stuff won't always go through. THanks to spammers, there's companies that make bajillions doing stuff like this for clients.
posted by SpecialK at 3:26 PM on January 5, 2006


The way that StarForce mentioned is prone to failure because most SMTP servers will back-check your server. It's much safer to authenticate and relay through your corporate SMTP server, which is already set up correctly with DNS. :-P
posted by SpecialK at 3:29 PM on January 5, 2006


I haven't had much problem with the method I described, then again I make sure the HELO address I send actually matches the server I'm sending from which also happens to be a mail server so any server that bothers to check back seems satisfied.
posted by StarForce5 at 3:43 PM on January 5, 2006


No offense, but I can't stand it when friends enter my email address in a form on some website. You never know what they'll do with it.

What is so hard with simply giving them a simple mailto link? You can create the whole message, including subject and body with it. Of course, they'll need a mail client installed and setup, but most people probably have that.
posted by delmoi at 5:53 PM on January 5, 2006


I second the mailto suggestion, otherwise I'd recommend PHPMailer.
posted by Sharcho at 7:42 PM on January 5, 2006


« Older Are there any methods for prev...   |   How much has your own attracti... Newer »

You are not logged in, either login or create an account to post comments



Related Questions
CMS for a resource website February 12, 2008
So I know HTML. What to learn next? December 10, 2006
Surviving a Total Perspective Vortex July 9, 2006
Light-weight image browser? May 26, 2006
You Sir, name password. December 21, 2005