Link to home
Start Free TrialLog in
Avatar of blnukem
blnukem

asked on

eMail now being tagged as spam HELP!!!

Hi all

My emails that are sent via a web form are now being tagged as spam to all of my customers that have spam assassin installed on their ISP's servers. I need to resolve this without the use of any modules as I can not add them due to security issues.


FORM CODE:

open (MAIL, "|/bin/sendmail -t") || &DieSafe("Can't open /bin/sendmail!\n");\

print MAIL "From: $AdminsEmail (www.$BusinessesDomain)\n";
print MAIL "Reply-To: $AdminsEmail (www.$BusinessesDomain)\n";
print MAIL "To: $FORM{'Email'} ($FORM{'ContactName'})\n";  
print MAIL "Subject: Copy of your $FormUsedFor to $BusinessesDomain.\n";

print MAIL "\n\nOn $Date you sent the following $FormUsedFor to $BusinessesDomain.\n\n";

print MAIL "Contact: $FORM{'FirstName'} $FORM{'LastName'}\n";
print MAIL "Email: $FORM{'Email'}\n\n";

if($FORM{'Company'}){
print MAIL "Company Name: $FORM{'Company'}\n";
}


if($FORM{'Phone'}){
print MAIL "Phone: $FORM{'Phone'}\n\n";
}

if($FORM{'Hearaboutus'}){
print MAIL "How did you hear about us: $FORM{'Hearaboutus'}\n\n";
}

print MAIL "Message: $FORM{'Message'}\n\n";

print MAIL "\n__________________________________________________\n\n";

print MAIL "$BusinessesName\n";
print MAIL "$BusinessesStreetAddress\n";
print MAIL "$BusinessesTown, $BusinessesState $BusinessesZip\n\n";

print MAIL "Phone: $BusinessesPhone\n";

if($BusinessesFax){
print MAIL "Fax: $BusinessesFax\n";
}

print MAIL "Thank you for visiting www.$BusinessesDomain!\n\n";
close(MAIL);


SPAM SCORING RULES :

Marked as spam if score is over  5.0

0.5 HTML_20_30             BODY: Message is 20% to 30% HTML
0.1 MIME_HTML_ONLY         BODY: Message only has text/html MIME parts
0.0 HTML_MESSAGE           BODY: HTML included in message
0.7 MIME_HTML_NO_CHARSET   RAW: Message text in HTML without charset
3.3 MSGID_FROM_MTA_SHORT   Message-Id was added by a relay
1.9 MIME_HEADER_CTYPE_ONLY 'Content-Type' found without required MIME
Avatar of FishMonger
FishMonger
Flag of United States of America image

Have you tried contacting the ISP's and asking them to add you to their whitelist?
Avatar of DireOrbAnt
DireOrbAnt

Add this line after the subject one:
print MAIL "MIME-Version: 1.0\n";
print MAIL "Content-Type: text/plain\n";

That should take care of:
1.9 MIME_HEADER_CTYPE_ONLY 'Content-Type' found without required MIME
ASKER CERTIFIED SOLUTION
Avatar of DireOrbAnt
DireOrbAnt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is not a perl issue.  This is an issue that you have been tagged by spamass - you will need to get them to untag you.

Did you spam?

I will tell you that as a matter of practice I send eMails from a variety of domains that are never my real one.  With domain names being as cheap as they are today this is the solution, then when you get tagged you just close that down and start again.  You may also need to move to a different ip but I have rarely found that to be true.

And, NO, I do not send spam!
jhurst, SpamAssassin, as with most SPAM engine, uses a set of rules to flag you as SPAM, when you reach a set number of "spam points", you are out.
So this IS a perl issue for blnukem. If he can send out a proper set of Mail headers, the filters will cut him a break.

blnukem, try the extra prints and post here the SPAM result (if any).

Now, you could also ask every ISP in the world (or your client's) to whitelist you... But might will refuse and if you can fix the issue from your side, you don't need to involve anybody else.
I do not agree with you Dire.., I think that he is being flagged not because he is not setting the headers but because hs is being seen as triggering some other rule.  I believe that the evidence for this is that he has not changed the headers that he sends and he used to be able to get past the filters and now can not.

Further, I have software that sends out a little over 20million eMails, all double-opt-in, and so have seen this type of thing with SpamAssassin before.

BTW, the root/origin of Assassin is the same as Hashish :)
You biggest spamassassin scorer (3.3) is the message-id being added by a mail relay.  I had the same issue with my postcard software, so I changed it to add it's own message ID.

eg:

my $msg_id = int(time).rand().rand() . '@mydomain.com';

print MAIL "Message-ID: $msg_id\n";
For those who think this *is* a Perl issue, let's change the script to:


#!/bin/ksh
( print "From: $AdminsEmail (www.$BusinessesDomain)\n";
print "Reply-To: $AdminsEmail (www.$BusinessesDomain)\n";
print "To: $Email ($ContactName)\n";
print "Subject: Copy of your $FormUsedFor to $BusinessesDomain.\n";

print "\n\nOn $Date you sent the following $FormUsedFor to $BusinessesDomain.\n\
n";

print "Contact: $FirstName $LastName\n";
print "Email: $Email\n\n"; ) | /usr/lib/sendmail -t


As you can see, the script is virtually the same as the Perl version.  Does this now turn the problem into a ksh issue?

I'm not trying to be smart or funny here, but one of the most important problem solving skills is to be able to partition the problem, ie: determine which technology is part of the problem.  In this instance, the problem wasn't with Perl but with the email headers being generated.  The generation of email headers is pretty much the same in whatever language you are using (unless you are using a library/module) because all you are essentially doing is a print.

Same applies for Perl scripts that generate dodgy HTML.  It's the HTML that's dodgy, not inherently the Perl script.
I never mean't to say that "Perl" was the problem here. Sorry if it was taken that way. Since the program is in Perl, I guess I used it.
So, I meant to say, it's an issue with how the program is written. How is that?

Now, I deal with plenty of email sending myself, maybe not to the extent jhurst does.

So for starters, blnukem is not sending out a proper set of email headers, that's a fact. If this was an issue with one of my script/program, I would first try to see how I could solve it from my side, before involving everyone.

In my post, I proposed adding 4 headers (including Message-ID) to make it (more) compliant..
From the Spam Assasin score (those are facts too), it could remove all of these:
0.7 MIME_HTML_NO_CHARSET   RAW: Message text in HTML without charset
3.3 MSGID_FROM_MTA_SHORT   Message-Id was added by a relay
1.9 MIME_HEADER_CTYPE_ONLY 'Content-Type' found without required MIME

So he would keep these ones:
0.5 HTML_20_30             BODY: Message is 20% to 30% HTML
0.1 MIME_HTML_ONLY         BODY: Message only has text/html MIME parts
0.0 HTML_MESSAGE           BODY: HTML included in message

That would give him a SpamAssassin score of 0.6 and would let the email go to their recipients.

If it works, which I think it will (maybe with a tweak or two), then blnukem will reach his goal, sending emails to customers.
And the effort will be minimal, so I'm not sure what we are all arguing about, if we are ;)
Sorry, DireOrbAnt.

Didn't see your post about Message-Id.  I don't think we're arguing, we're just having robust and useful discussions :-)
>>>robust and useful discussions
Cool, I'm down! Nice login name.
blnukem? Have you tried any of this yet?

We're dangling on a "thread" here, Tintin is just about to pass out!

Please let us know if you resolved your issue.

DOA
Avatar of blnukem

ASKER

Sorry about the delay I was away anyway here is what I did:

my $MSG_ID = int(time).rand().rand() . "\@$BusinessesDomain";

open (MAIL, "|/bin/sendmail -t") || &DieSafe("Can't open /bin/sendmail!\n");\

print MAIL "From: $AdminsEmail (www.$BusinessesDomain)\n";
print MAIL "Reply-To: $AdminsEmail (www.$BusinessesDomain)\n";
print MAIL "To: $FORM{'Email'} ($FORM{'ContactName'})\n";  
print MAIL "Subject: Copy of your $FormUsedFor to $BusinessesDomain.\n";

print MAIL "MIME-Version: 1.0\n";
print MAIL "Content-Type: text/plain; charset=\"US-ASCII\"\n";
print MAIL "Content-Transfer-Encoding: 7bit\n";
print MAIL "Message-ID: $MSG_ID\n";
Not flagged as spam anymore? Can you output the resulting SpamAssassin headers (if any) so we/you can see if there is more improvements to be done?
The order of the headers is important.  You should use

print MAIL <<EOF;
From: $AdminsEmail (www.$BusinessesDomain)
Reply-To: $AdminsEmail (www.$BusinessesDomain)
To: $FORM{'Email'} ($FORM{'ContactName'})
MIME-Version: 1.0
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit
Message-ID: $MSG_ID
Subject: Copy of your $FormUsedFor to $BusinessesDomain.

On $Date you sent the following $FormUsedFor to $BusinessesDomain.

Contact: $FORM{'FirstName'} $FORM{'LastName'}
Email: $FORM{'Email'}

EOF