Improving Email Deliverability
When your forms send mail, are you certain the emails are delivered? Some ISPs bounce email without a valid email address as the Return-Path.
(There may be other deliverability issues in addition to or instead of an invalid Return-Path email address. This article addresses only Return-Path.)
It isn't difficult to specify a valid Return-Path. Do it to ensure your form's email is actually delivered.
I'll show you how.
When a Perl script sends email through the server's sendmail software without specifying a return path, sendmail will insert default information. The default information might or might not be a valid email address, depending on how sendmail is configured.
I'll show you how to check what your sendmail does. And I'll show you how to designate a custom Return-Path email address.
Post-publication addition: An email testing tool is available in the WebSite's Secret member's area. It is for debugging email issues related to email sent with both Perl CGI and PHP email sending scripts. It can be used to test To and From email addresses, the bounce email address, custom header lines, and other aspects.
Website Secrets members, click here.
Non-WebSites Secrets members, click here.
Checking What Your sendmail Does
If you don't have a script you can use to see what your server's installation of sendmail inserts as default information, you may use the one below. Specify a destination that does not bounce invalid return path emails.
#!/usr/bin/perl # Verify above is correct. use strict; my $Destination = 'name@example.com'; # Change above email address to correct destination. # Verify sendmail location is correct (-t flag is required). my $Sendmail = '/usr/sbin/sendmail -t'; open MAIL,"|$Sendmail"; print MAIL <<EMAIL; From: $Destination To: $Destination Subject: Default return path test\n View full/raw headers to see what Return-Path information was inserted. EMAIL close MAIL; print "Content-type: text/html\n\nEmail has been sent."; # end of script
Use a plain text word processor to edit the script.
Give the script an appropriate file name, upload as ASCII/plain text into a directory that can run Perl CGI script, and give it 755 permissions.
Type the URL of the script into your browser. Then check your email.
When the email arrives, view full headers and see what the "Return-Path:" lines says. Your email software's help system should tell you how to view full headers.
Specifying a Custom Return-Path Email Address
A custom return path can be specified with the sendmail -f flag. This is the format:
-fname@example.com
Notice there is no space between the "-f" and the email address. (For a live implementation, replace name@example.com with the appropriate address.)
For a sendmail path in a Perl script, the format would be something like this:
/usr/sbin/sendmail -t -fname@example.com
In the above example script, it would be specified as:
my $Sendmail = '/usr/sbin/sendmail -t -fname@example.com';
For CGI scripts with control panels where the sendmail location is specified, it may be possible to specify the -f flag at the same time.
Certainly that's possible with Master Series CGI scripts.
For scripts with control panels that will not accept the -f flag, the script itself might be modified. Talk to the author of the script to see what s/he recommends.
Will Bontrager