PDA

View Full Version : PHP email - marked as spam


P3k
02-25-2008, 07:55 AM
I use this script for sending email from FLASH pages... But antispam robot that is on sever marked my emails like spam. Where is problem ?




<?
if(!empty($HTTP_POST_VARS['sender_mail']) || !empty($HTTP_POST_VARS['sender_message']) || !empty($HTTP_POST_VARS['sender_subject']) || !empty($HTTP_POST_VARS['sender_name']))
{
$to = "info@whatever.com";
$subject = stripslashes($HTTP_POST_VARS['sender_subject']);
$body = stripslashes($HTTP_POST_VARS['sender_message']) . "\n\n";
$body .= "Items : " .$HTTP_POST_VARS['sender_checkboxes'] . "\n";
$body .= "\n\n______________________________________________ _______\n";
$body .= "Company : " .$HTTP_POST_VARS['sender_comp'] . "\n";
$body .= "Sender : " .$HTTP_POST_VARS['sender_name'] . "\n";
$body .= "Email : " .$HTTP_POST_VARS['sender_mail'] . "\n";
$body .= "Phone : " .$HTTP_POST_VARS['sender_phone'] . "\n";
$body .= "Address : " .$HTTP_POST_VARS['sender_address'] . "\n\n";
$body .= "Question : " .$HTTP_POST_VARS['sender_question'] . "\n";
$body .= "\n\n______________________________________________ _______\n";
$header = "From: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";
$header .= "Reply-To: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";
$header .= "X-Mailer: PHP/" . phpversion() . "\n";
$header .= "X-Priority: 1";
if(@mail($to, $subject, $body, $header))
{
echo "output=sent";
} else {
echo "output=error";
}
} else {
echo "output=error";
}
?>


And this is reason, that antispam robot send to email :

Analyse: (3.3 points, 3.0 required)

score filtr description
---- ---------------------- -------------------------------------------
2.7 FH_FROMEML_NOTLD E-mail address doesn't have TLD (.com, etc.)
0.5 BAYES_60 BODY: Bayesian spam probability is 60 to 80%
[score: 0.7579]
0.0 SUBJECT_NEEDS_ENCODING SUBJECT_NEEDS_ENCODING
0.1 RDNS_NONE Delivered to trusted network by a host with no rDNS

CyanBlue
02-25-2008, 02:38 PM
What do you do to prevent the first item happening???

P3k
02-25-2008, 03:03 PM
I do nothing....

This is actionscript code for the checking email text field when user :


Semail.onKillFocus = function() {
if (text6 == "") {
text6 = label_06;
}
};
Semail.onSetFocus = function() {
if (text6 == label_06) {
text6 = "";
}
};

P3k
02-25-2008, 03:18 PM
I know where I did mistake and why antispam robot marked email like spam... :rolleyes:

It happend , when I wrote wrong senders email address like - info@domain,com


Now I think... :confused: ... It would be better to check email text field in flash... not by PHP code...

CyanBlue
02-25-2008, 03:25 PM
Where did you get that 'Analyze' portion???

I think you should do that on both side just to make sure... ;)

P3k
02-25-2008, 03:52 PM
Where did you get that 'Analyze' portion???


The company - forpsi.com - where I host my domains... they use antispam robots...

btw - emails from this forum are also marked as spam :)

Marked emails look like this :

------------------------------------------------------------------------
Spam detection software, running on the system "mxavas2.forpsi.com", has
identified this incoming email as possible spam. The original message
has been attached to this so you can view it (if it isn't spam) or label
similar future email.
------------------------------------------------------------------------

Nahled emailu (Content preview): Dear P3k, CyanBlue has just replied to a thread you have subscribed
to entitled - syntax problem - in the Components forum of ActionScript.org
Forums. This thread is located at: http://www.actionscript.org/forums/showthread.php3?t=161955&goto=newpost
[...]

Analyse: (3.1 points, 3.0 required)

score filtr (description)
---- ---------------------- -------------------------------------------
3.0 BAYES_95 BODY: Bayesian spam probability is 95 to 99%
[score: 0.9777]
0.1 RDNS_NONE Delivered to trusted network by a host with no rDNS

P3k
02-25-2008, 04:00 PM
I think you should do that on both side just to make sure... ;)

I dont know how to do that. Flash is not so easy to me... and PHP is much harder...

I'll be happy, when I find some solution for flash side. I am trying to find some solution... but still without any consequence...

CyanBlue
02-25-2008, 04:44 PM
Well... That's the beauty of the Bayesian method... If the host had more database entry that says that the emails which look like something something probably are spam emails, so the email from the AS.org is marked as a spam as well...

As for the email validation, there are so many tutorials out there... Go check them out... ;)
Oh, I have one in my signature link as well...

rwd
02-27-2008, 07:05 PM
The best AS email checker I have found:


String.prototype.isEmail = function()
{

//email address has to have at least 5 chars
if (this.length < 5)
{
return false;
}

var iChars = "*|,\":<>[]{}`';()&$#%";
var eLength = this.length;

for (var i=0; i < eLength; i++)
{
if (iChars.indexOf(this.charAt(i)) != -1)
{
// trace("Invalid Email Address : Illegal Character in Email Address : -->" + this.charAt(i) + "<--.");
return false;
}
}

var atIndex = this.lastIndexOf("@");
if(atIndex < 1 || (atIndex == eLength - 1))
{
// trace("Invalid Email Address : Email Address must contain @ as at least the second chararcter.");
return false;
}

var pIndex = this.lastIndexOf(".");
if(pIndex < 4 || (pIndex == eLength - 1))
{
// trace("Invalid Email Address : Email Address must contain at least one . (period) in a valid position");
return false;
}

if(atIndex > pIndex)
{
// this.__error = "Invalid Email Address : Email Address must be in the form of name@domain.domaintype";
return false;
}

return true;
}


and php.. easy peasy


<?php
function check_email($email)
{
$atom = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]';
$domain = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';
return eregi("^$atom+(\\.$atom+)*@($domain?\\.)+$domain\$", $email);
}
?>



and a great mailer php class:

http://www.phpclasses.org/browse/file/919.html