Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

perl script to send email...

by kiat (Vicar)
on Mar 23, 2004 at 08:38 UTC ( #338926=perlquestion: print w/replies, xml ) Need Help??
kiat has asked for the wisdom of the Perl Monks concerning the following question:

Hi and greetings to all,

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 tried this site's Forgot Your Password mailer and the email reached my Yahoo Inbox. I compared that password resend email and the one I'm experimenting and observed they are pretty much the same - subject, from, to are all filled.

I thought it was something to do with the sender's email - like if you have 'admin' or 'anonymous' in the sender's email (, 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" <>~; use Mail::Sendmail; unshift @{$Mail::Sendmail::mailcfg{'smtp'}} ,''; my %mail = ( To => $recipient, From => $sender, Subject => $subject, Message => $message, ); sendmail(%mail) or die $Mail::Sendmail::error; }
Is anything amiss?

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
    You should compare the FULL headers of both mails. For instance, it could be that the mail you are sending has
    Precedence: Bulk
      Thanks, matija! This header thing is new to me. Will check it out.
Re: perl script to send email...
by b10m (Vicar) on Mar 23, 2004 at 12:18 UTC
    I've a perl mailer script (using Sendmail) to email a notification to a specified email address after a form is filled out.
    I've tried this site's Forgot Your Password mailer and the email reached my Yahoo Inbox.

    Are you talking about the same server that is sending the emails? First you talk of "I have..." and after that "I've tried this site's", which makes me think the second one is not the same as the first.

    Your sending MTA's IP address might be listed in some RBL. You can test that at sites as or


    All code is usually tested, but rarely trusted.
      Thanks, b10m!

      No, I was talking about perlmonk's Forgot Your Password script. I experimented with it and the message went to my Yahoo's Inbox. However, the message I send using the emailer script I'm experimenting on my site goes to Yahoo's Bulk, which got me curious.

      I've since found out what the cause is. Please read my main post for the update.


Re: perl script to send email...
by TomDLux (Vicar) on Mar 23, 2004 at 16:18 UTC

    My message to my Yahoo account got through, URL and all. Perhaps it's something about the parrticular URL that triggers the spam-detection software?

    Mail with URLs is essential ... you tell a friend to visit a web site; you join a new web site or mailing list and receive a message with a link to verify your identity; mailing list messages (Yahoo groups, for example) frequently have a URL in the 'signature' leading to mailing list information.


      I don't know what Yahoo is using, but I bet it's comparable to SpamAssassin, which "counts" elements that can be considered "spam". See the tests for more information. The less test come out positive, the better chances are the mail will go straight to the inbox.


      All code is usually tested, but rarely trusted.
      You're right. I'll do more test with the url in question to see what exactly causes the email in which it's contained to be treated as Bulk.

      I've emails from forums informing me that I've got replies from my posts. Those emails also contained urls but they got through to my Yahoo Inbox. So it must be something to do with the text of that offending url.

      I'll post the result of my finding if I should be able to nail down anything.

      It baffles me but what I've found so far is this:

      When the email contains the words 'Please click on the link below to activate your account: url_here', it goes to Bulk.

      When it contains 'Please proceed to register at the link below: url_here', it goes to Inbox.

      It could be the words "activate your account". It's quite a mystery to me.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://338926]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2018-04-27 07:55 GMT
Find Nodes?
    Voting Booth?