Postfix header checks to reject spam mails :
/^Subject:.*=\?(big5|euc-kr|gb2312|ks_c_5601-1987)\?/ REJECT No foreign character sets, please.
/^(Content-Type:.*|\s+)charset\s*=\s*”?(big5|euc-kr|gb2312|koi8|Windows-1251|ks_c_5601-1987)”?/ REJECT No foreign character sets, please.
/^(Content-Type:.*|\s+)charset\s*=\s*”?(Windows-1251)\?/ REJECT Probably a windows virus.
/^From:.*\@.*\.r[uo]/ REJECT No Russian or Romanian mail, please.
/^From:.*\@.*\.bg/ REJECT No foreign character sets for bg, please.
/^From:.*\@.*\.nz/ REJECT No foreign character sets for nz, please.
/^From:.*\@.*\.lb/ REJECT No foreign character sets for lb, please.
/^From:.*\@.*\.cz/ REJECT No foreign character sets for cz, please.
/^From:.*\@.*\.kr/ REJECT No foreign character sets for kr, please.
/^From:(.*)Screen Saver / REJECT Screensaver virus, die.
/^From:(.*)mchsi.com/ REJECT Stop sending us crap.
/^From:lpinsk@localnet.com]/ REJECT Stop sending us crap.
/^From:(.*)[Aa]meritas/ REJECT Die, spammer, die.
/opt-in/ REJECT Typical Spammer Word “Opt..”
/^Received:.*\.{50,}/ REJECT Bogus received address
/^(Received|Message-Id|X-(Mailer|Sender)):.*\b(AutoMail|E-Broadcaster|Emailer Platinum|eMarksman|Extractor|e-Merge|
from stealth[^.]|Global Messenger|GroupMaster|Mailcast|MailKing|
Match10|MassE-Mail|massmail\.pl|News Breaker|Powermailer|Quick Shot|Ready Aim Fire|WindoZ|WorldMerge|Yourdora|Lite)\b/ REJECT You’re using a mass mailer, therefore you’re bounced.
/^received:.*xxxxxxxxxxxxxxxx/ REJECT X-Rated Subject Line
/^Received:(.*)hispeedmailer\.com/ REJECT Mass-mailer. Die, spammer, die.
/^From:(.*)cupid\@valentines-ecard\.com/ REJECT Potential Virus Content
/^Return-Path:(.*)offers@/ REJECT We get too many offers.
/^Subject:(.*)penis/ REJECT You said the p-word
/^Subject:(.*)your password/ REJECT Die, spammer, die.
/^Subject:(.*)Bigger Bust/ REJECT We’ve got big busts, already.
/^Subject:(.*)adult/ REJECT X-Rated Subject Line
/^Subject:(.*)AS SEEN ON T\.V/ REJECT We don’t watch TV.
/^Subject:(.*)barnyard/ REJECT No barnyard please
/^Subject:(.*)beast/ REJECT X-Rated Subject Line
/^Subject:(.*)bitch/ REJECT X-Rated Subject Line
/^Subject:(.*)bodies/ REJECT X-Rated Subject Line
/^Subject:(.*)breast/ REJECT X-Rated Subject Line
/^Subject:(.*)fuck/ REJECT X-Rated Subject Line
/^Subject:(.*)galore/ REJECT X-Rated Subject Line
/^Subject:(.*)gay/ REJECT X-Rated Subject Line
/^Subject:(.*)porn/ REJECT X-Rated Subject Line
/^Subject:(.*)slut/ REJECT X-Rated Subject Line
/^Subject:(.*)HARDCORE/ REJECT X-Rated Subject Line
/^Subject:(.*)russian/ REJECT God bless america
/^Subject:(.*)teen/ REJECT X-Rated Subject Line
/^Subject:(.*)viagra/ REJECT No thanks, we’ve got plenty.
/^Subject:(.*)viaagra/ REJECT No thanks, we’ve got plenty.
/^Subject:(.*)viiagra/ REJECT No thanks, we’ve got plenty.
/^Subject:(.*)v1agra/ REJECT No thanks, we’ve got plenty.
/^Subject:(.*)viagr@/ REJECT No thanks, we’ve got plenty.
/^Subject:(.*)v1@gra/ REJECT No thanks, we’ve got plenty.
/^Subject:(.*)viag*ra/ REJECT No thanks, we’ve got plenty.
/^Subject:(.*)soma/ REJECT No thanks, we’ve got plenty.
/^Subject:(.*)levitra/ REJECT No thanks, we’ve got plenty.
/^Subject:(.*)ambien/ REJECT No thanks, we’ve got plenty.
/^Subject:(.*)tramadol/ REJECT No thanks, we’ve got plenty.
/^Subject:(.*)phentermine/ REJECT No thanks, we’ve got plenty.
/^Subject:(.*)xxx/ REJECT X-Rated Subject Line
/^Subject:(.*)orgasms/ REJECT X-Rated Subject Line
/^Subject:(.*)size does matter/ REJECT X-Rated Subject Line
/^(To|From|Cc|Reply-To):.*@sexyfun.net/ REJECT X-Rated Subject Line
/^To:(.*)infomail@recurrent\.com/ REJECT Die, spammer, die.
/^(To|From|Cc|Reply-To):.*@sunny95.com/ REJECT We don’t like radio.
/^X-Mailer:.*\b(Aristotle|Avalanche|Blaster|Bomber|DejaVu|eMerge|Extractor|UltraMail|Sonic
|Floodgate|GeoList|Mach10|MegaPro|Aureate|MultiMailer|Bluecom|Achi-Kochi Mail|Direct Email|Andrew’s SuperCool Blastoise|MailerGear|Advanced Mass Sender|SpireMail|MailWorkZ|UltimDBMail|Mabry|Lite)\b/ REJECT No mass-mailers, please.
/^Subject:(.*)pen[i1]s/ REJECT You said the p-word
/^Subject:(.*)\bdick\b/ REJECT X-rated spam
/^(To|From|Cc|Reply-To):.*@sympatico.ca/ REJECT You spammed us, now you’re blocked. Sympatico.ca…
/^(To|From|Cc|Reply-To):.*@optonline/ REJECT You spammed us, now you’re blocked. Optonline…
/^(To|From|Cc|Reply-To):.*@sendspeed/ REJECT You spammed us, now you’re blocked. Sendspeed…
/^(To|From|Cc|Reply-To):.*@pillsavings/ REJECT You spammed us, now you’re blocked. pillsavings…
/^(To|From|Cc|Reply-To):.*@edirectmessage.com/ REJECT You spammed us, now you’re blocked. edirectmessage…
/(.*)?\{6,\}/ REJECT Too many ?????
/(.*)[X|x]\{3,\}/ REJECT Too many Xs
/^(To|From|Cc|Reply-To):.*@lists.itsahullabaloo-lists.net/ REJECT No more hullabalos, please
/^(To|From|Cc|Reply-To|Subject):.*Free Cellular Phone/ REJECT We already have cell phones.
/^(From|mailto):.*@sina.com/ REJECT sina.com spammed us, now you’re out.
/^(From|mailto):.*@bomx1.com/ REJECT bomx1.com spammed us, now you’re out.
/^(From|mailto):.*@pornopassprt.com/ REJECT no porn mail, please.
/^Subject:(.*)[Ss]ildenalfil/ REJECT You meant the v-word.
/^Subject:(.*)[Cc]itrate/ REJECT You meant the v-word.
/^Subject:(.*)[Cc]ialis/ REJECT c_ialis
/^Subject:(.*)[Ee]nzyte/ REJECT e_nzyte
/^Content\-Transfer\-Encoding:(.*)base64$/ REJECT (base_64)
Share or Bookmark This Post With :
Send Simple HTML email with JavaMail
The JavaMail API provides a platform-independent and protocol-independent framework to build mail and messaging applications.
This one is the simple program which can be used to send email with JAVA.
import javax.mail.internet.*;
import java.util.Properties;
class SimpleHTMLMail {
public static void main(String[] args) throws Exception{
System.out.println("Sending mail…");
Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", "smtp.mymailserver.com");
props.setProperty("mail.user", "myuser");
props.setProperty("mail.password", "mypwd");
Session mailSession = Session.getDefaultInstance(props, null);
mailSession.setDebug(true);
Transport transport = mailSession.getTransport();
MimeMessage message = new MimeMessage(mailSession);
message.setSubject("HTML mail with images");
message.setFrom(new InternetAddress("you@domain.com"));
message.setContent("<h1>This is a test</h1>"
+ "<img src=\"http://www.domain.com/image.gif\">",
"text/html");
message.addRecipient(Message.RecipientType.TO,new InternetAddress("receive@domain.com"));
transport.connect();
transport.sendMessage(message,message.getRecipients(Message.RecipientType.TO));
transport.close();
}
}
Share or Bookmark This Post With :
Install Spamassassin in Debian
#apt-get install spamassassin spamc
spamassassin package can also be integrated into a Mail Transport Agent such as postfix.
Preparation
By default Spamassassin will run as root users when you install from debian repository and is not started to avoid that, we are going to create a specific user and group for spamassassin.
#groupadd -g 5001 spamd
#useradd -u 5001 -g spamd -s /sbin/nologin -d /var/lib/spamassassin spamd
#mkdir /var/lib/spamassassin
#chown spamd:spamd /var/lib/spamassassin
References :
Postfix and Spamassassin: How to filter spam
Share or Bookmark This Post With :
- dotProject – the Open Source Project Managem...
- The jQuery Form Plugin
- DocVerse has officially been acquired by Google
- HDGraph – a free tool for Windows to draw mu...
- RandomClass jQuery Plugin
- Paparazzi – a small utility for Mac OS X to ...
- Blocking SPAM using Postfix header_checks and Spam...
- Facebook, Paypal team up for virtual goods payment
- Opera Mini – the next generation mobile brow...
- XML/SWF Charts – powerful tool to create att...
- Send emails using PHPMailer an...
- Firefox Addons Essential for S...
- Free SEO Tools From SEOMoz.org...
- URL Rewriting for PHP Web Appl...
- Multiple Instances of Tomcat w...
- Apache 2.x + Tomcat 4.x + Load...
- Pagination in JSP/Java
- PHP – Mysql Open Source ...
- java.lang.OutOfMemoryError: Ja...
- HOW TO Subversion+Apache on Fe...





