10 msgheader check question
12 msgverify parameters
4 msgConfigure postfix in big env
2 msgenvelope sender '<>' via uucp gets rewrit...
2 msgSpam filtering only for specific email accounts
3 msgPostfix 2.4 to 2.5: smtp(d)_tls_session_cache_d...
15 msgQuestion about 'standards' WRT BATV and SAV

my solution to fight backscatter email
\ nik600 (8 May 2008)
. \ (Wietse Venema) (8 May 2008)
. . \ nik600 (9 May 2008)
. . . \ Glenn Matthys - Webmind (9 May 2008)
. . . \ (Wietse Venema) (9 May 2008)
. . . \ Terry Carmen (9 May 2008)
. . . \ mouss (9 May 2008)

2 msgAUTO: Joe Grastara is out of the office (return...
12 msgQ about sender_dependent_relayhost_maps inbound...
16 msgMilter Suggestions
9 msgTransport table and postmap
3 msgArchiving e-mail?
8 msgError 550: unable to relay
1 msgFW: new subject
13 msgTLS handshake error
6 msgSeperating SMTP and POP/IMAP services
3 msgTest 2
1 msgTesting
12 msg[Fwd: ldap users & aliases config]
Subject:my solution to fight backscatter email
Group:Postfix-users
From:nik600
Date:8 May 2008


 
Hi to all

i want to show you my solution about how to fight backscatter, pleas
tell me what do you think about that:

The concept is to store in a whitelist-db To and CC emails of my
outbound emails, and when i receive an email with a delivery error,
check if the Final-Recipient is in my whitelist.

I've implemented it in 2 php files, one must be run for each outgoing
email, and the other one for each incoming email.

/*
************************ FOR EACH OUTGOING EMAIL
*/
<?php

/*
the content of the email can be retrieved or by stdin or by reading
it from a tmpfile
*/
$content = file_get_contents("Sent");

/*
look only in the headers of the email
*/
$headers = strtoupper(substr($content,0,strpos($content,"Content-Type:")));


/*
retrieve To: and CC: destinations
*/
$start_to = strpos($headers,"\nTO:");
$start_cc = strpos($headers,"\nCC:");
$start_subject = strpos($headers,"\nSUBJECT:");

if($start_cc!==false){
$to = substr($headers,$start_to,$start_cc-$start_to);
$cc = substr($headers,$start_cc,$start_subject-$start_cc);
}else{
$to = substr($headers,$start_to,$start_subject-$start_to);
}


$res_to = get_address($to);
$res_cc = get_address($cc);

$final_email = array_merge($res_to,$res_cc);


foreach($final_email as $email){

/*
store email in my backscatter whitelist
*/

}



/**
* return an array filled with the emails found in $address
*/
function get_address($address){

$results = array();

$address = explode(",",$address);

foreach($address as $email){

if(strpos($email,"<")!==false){

$mail = substr($email,strpos($email,"<")+1,strpos($email,">")-strpos($email,"<" )-1);

}else{

$mail=$email;

}

$mail = trim($mail);

array_push($results,$mail);

}

return $results;

}
?>


/*
************************ FOR EACH INCOMING EMAIL
*/
<?php

$content = file_get_contents("backscatter");


$final_recipient = strpos($content,"Final-Recipient: rfc822;");

if($final_recipient!==false){

/*
this is a mail with a delivery failure
i try to retrieve the original destination of the email
*/
$email_final_recipient =
substr($content,$final_recipient,strpos($content,"\n",$final_recipient)-$final_r ecipient);

$email_final_recipient =
substr($email_final_recipient,strlen("Final-Recipient: rfc822;"));

$email_final_recipient = trim($email_final_recipient);

$email_final_recipient = strtoupper($email_final_recipient);


/*
now i check if the email is in my backscatter whitelist
*/

check....

}else{

/* OK, this email isn't a mail with a delivery failure */

}



?>
--
/*************/
nik600
https://sourceforge.net/projects/ccmanager
https://sourceforge.net/projects/reportmaker
https://sourceforge.net/projects/nikstresser


© 2004-2008 readlist.com