kiat has asked for the wisdom of the Perl Monks concerning the following question:
This isn't really related to perl per se but perhaps someone here can offer some enlightenment.
I've a perl mailer script (using Sendmail) to email a notification to a specified email address after a form is filled out.
The sending gets through but the trouble is the email is treated as Bulk Mail by Yahoo as well as Hotmail (don't know about other other mail servers). Hence, the risk that the notification gets ignored because it went into Bulk and not Inbox.
I thought it was something to do with the sender's email - like if you have 'admin' or 'anonymous' in the sender's email (admin@mysite.com), the email gets treated as junk. But even after changing the sender's email to my personal email, the same thing happens.
I've pasted the code below in case I've missed anything...
sub notify { my ($recipient, $subject, $message) = @_; my $sender = q~"Mailer" <kiat@starhub.com>~; use Mail::Sendmail; unshift @{$Mail::Sendmail::mailcfg{'smtp'}} ,'smtp.somesite.com'; my %mail = ( To => $recipient, From => $sender, Subject => $subject, Message => $message, ); sendmail(%mail) or die $Mail::Sendmail::error; }
Thanks for reading :)
Update 1: Looks like it's the smtp server issue. It seems the email is routed through at least two servers being reaching its destination. I read somewhere that the destination email server recognises that sort of email as Bulk or Junk mail. :(
Update 2 (Solution): I found the offending part of the email that's causing Yahoo to treat it as Bulk instead of a normal email. My original message in that email contains a link for the recipient to click on to confirm his account. When I removed that link from the message, the email went to my Yahoo's Inbox, which is the intended effect. I did a confirmation by putting back the link and sure enough, the email went to Bulk. So that was the mystery :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl script to send email...
by matija (Priest) on Mar 23, 2004 at 08:54 UTC | |
by kiat (Vicar) on Mar 23, 2004 at 09:04 UTC | |
|
Re: perl script to send email...
by b10m (Vicar) on Mar 23, 2004 at 12:18 UTC | |
by kiat (Vicar) on Mar 23, 2004 at 13:10 UTC | |
|
Re: perl script to send email...
by TomDLux (Vicar) on Mar 23, 2004 at 16:18 UTC | |
by b10m (Vicar) on Mar 23, 2004 at 17:24 UTC | |
by kiat (Vicar) on Mar 23, 2004 at 23:58 UTC | |
by kiat (Vicar) on Mar 24, 2004 at 01:58 UTC |