Filtering Spam with JavaMail

My spam filter, ChiaraMail, has come up against some spam which it doesn't know how to deal with. Specifically, I've been getting more and more spam whose content is in HTML and obfuscated with "<...>" tags. For example,
M<foo>ake<bar>Mo<fasdf>ney<vcbvcx>Fas<rtew>t!
The obfuscating stuff gets filtered out by HTML readers, and therefore the "message" gets displayed OK. Is there a way for JavaMail to filter it out as well? This message obfuscation technique seems to be the state of the art in spamming technology, so I need to be able to deal with it (I get over 500 pieces of spam per day, which is why I wrote ChiaraMail). Thanks, in advance.
Bob

One way could be to first separate out each word,and then discard all unwanted words if any. Then in the remaining set in each word get rid of the special characters and do the above check again.
Whatever left is fairly clean. But this is just a trivial implementation. any body could get away by introducing an extra space within each letter !!!!
Good luck.
cheers
Projyal

Similar Messages

  • Problem with Javamail in Red Hat

    Good afternoon.
    I have a problem with javamail in Red Hat.
    When i send a email in windows with my application, works well. But in Red Hat no works.
    Gives the following error:
    Java.lang.ClassCastException .... gnu.mail.handler.TextPlain
    Does anyone know that happens?

    You have much to learn. This is the wrong forum for most of it.
    You should be able to use the package manager in Linux to
    uninstall the Gnu version. Then read this:
    [http://java.sun.com/products/javamail/FAQ.html#install|http://java.sun.com/products/javamail/FAQ.html#install]

  • How can i add a new user and change user'password with javamail?

    how can i add a new user and change user'password from a mailserver with javamail?
    email:[email protected]

    Well user creation and updation is a system property..U need to go through that part...as it depends on the system you are hosting pout your application...
    if it is linux...u have to use some shell programming\
    bye for now let me know if this guides you or if you need some more stuff.
    bye

  • How to send a message with javamail api

    Hi, anybody can tell me how i do to send a message with javamail?
    Thanks.
    Daniele.

    [rossifumi80],
    Here's a simple JavaMail application SendMessage.java that will connect a SMTP host and send a mail message out:
    import java.util.Properties;
    import javax.mail.*;
    import javax.mail.internet.*;
    public class SendMessage {
      public static void main (String args[]) throws Exception {
        String host = args[0];
        String from = args[1];
        String to = args[2];
        // Get system properties
        Properties props = System.getProperties();
        // Setup mail server
        props.put("mail.smtp.host", host);
        // Get session
        Session session = Session.getDefaultInstance(props, null);
        // Define message
        MimeMessage message = new MimeMessage(session);
        // Set the from address
        message.setFrom(new InternetAddress(from));
        // Set the to address
        message.addRecipient(Message.RecipientType.TO,
          new InternetAddress(to));
        // Set the subject
        message.setSubject("Hello JavaMail");
        // Set the content
        message.setText("Welcome to JavaMail");
        // Send message
        Transport.send(message);
    }HTH.
    Allen Lai
    Developer Technical Support
    SUN Microsystems
    http://www.sun.com/developers/support/

  • Sending � signs with JavaMail

    Hi chaps,
    At our company we use the JavaMail API through JNI to send emails externally to customers.
    Recently the business has decided that it would be nice to send pound (�) through, however it's not going to plan.
    Normally the messages are encoded in 7-bit which would seem to exclude the � (163), however it seems that it is first converted to a (=80, hex with no ascii correlation) and then to a Euro symbol.
    I've tried setting the "allow8bitmime" property in order to enable the SMTP service to support 8-bit encoding, but it's not working AND Microsoft say that our Exchange (v5.5) doesn't support 8-bit MIME types. The odd thing is that sending external emails via Exchange supports the � with no problems and is read in the mail reader as 8-bit encoded (!).
    Has anybody had any experience with issues like this ? Any reply appreciated.
    Thanks
    Ammonite

    Ammonite,
    I am working on a similar problem.. Did you say your
    email gets translated and prints the Euro symbol... I
    actually need out email to print Both the pound and
    the Euro and it does niether right now.. The current implementation I am working on will display a Euro instead of a pound, although this isn't by design. The message is encoded using "Quoted-Printable" and substitutes the pound for a =80 character. How this maps to a Euro is unknown to me :(
    In standard ascii the pound is outside the standard 7-bit encoding range (163) and featured in the Extended Set on the platform we use. I'm not sure about the Euro. The Iso-8859-1 charset which SH provided supports the pound in "Quoted-Printable" encoding, but this hasn't been well received by JavaMail MIME objects that I have tried.
    I haven't managed any sort of 8-bit encoding with JavaMail as yet, due to supposed lack of support in Exchange 5.5 and lack of response to the "allow8bitmime" property.
    does anyone know is using MimeMessage limit the
    message to ASCII characters only and does that rule
    out the Euro and the Pound symbol/
    It shoudn't rule them out, but I'm starting to believe that MimeMessages are necessarily helping things here :)

  • Sending chinese HTML with javamail - is there no definitive answer ?

    I'm using the following code to send a HTML and text e-mail
    (text for people with HTML-challenged email clients). I sent
    2 emails to 2 email addresses which reside on the same server
    - eg. [email protected] and [email protected] - and read the
    emails with the same e-mail client (Eudora) on the same PC.
    The HTML and Chinese displays perfectly when it's sent to one
    of the email addresses ([email protected]) but the HTML and
    Chinese are always corrupt when I send them to the other.
    This is a repeatable error and it has me completely stumped.
         // Example Initial values (drawn from a database) :
         String smtpHost = "mail.mydomain.com";
         String sender = "[email protected]";
         String subject = "Give me strength.... ";
         InternetAddress sender = new InternetAddress("[email protected]");
         InternetAddress receiver = new InternetAddress("[email protected]");
         String txtMsg = "a long text message blah...";
         String htmlMsg = "<h1>Wooo</h1><img src='http://mydomain.com/blink.gif'>";
         String language = "zh-tw" // can also be "en-us" or "zh-cn"
         // CREATE MAIL MESSAGE & HEADERS
         Properties props = System.getProperties();
         props.put("mail.smtp.host", smtpHost);
         Session session = Session.getDefaultInstance(props, null);
         Message msg = new MimeMessage(session);
         msg.setFrom(sender);
         msg.addRecipient(Message.RecipientType.TO, receiver);
         msg.setSubject(subject);
         msg.setSentDate(new Date());
         msg.setHeader("Mime-Version" , "1.0" );
         msg.setHeader("Content-Transfer-Encoding", "quoted-printable");
         // MESSAGE BODY - TEXT & HTML
         MimeMultipart mimeAllContent = new MimeMultipart("alternative");
         MimeBodyPart mimeText = new MimeBodyPart();
         MimeBodyPart mimeHtml = new MimeBodyPart();
         mimeText.setText(textMsg);
         mimeText.setHeader("Mime-Version" , "1.0" );
         mimeText.setHeader("Content-Type" , "text/plain");
         mimeText.addHeader("Content-Type", "charset=UTF-8");
         if (!language.equals("")) {
              mimeText.setHeader("Content-Language", language);
         mimeText.setHeader("Content-Transfer-Encoding", "quoted-printable");
         mimeHtml.setContent(htmlMsg, "text/html");
         mimeHtml.setHeader("Mime-Version" , "1.0" );
         mimeHtml.setHeader("Content-Type" , "text/html");
         mimeHtml.addHeader("Content-Type", "charset=UTF-8");
         if (!language.equals("")) {
              mimeHtml.setHeader("Content-Language", language);
         mimeHtml.setHeader("Content-Transfer-Encoding", "quoted-printable");
         mimeAllContent.addBodyPart(mimeText);
         mimeAllContent.addBodyPart(mimeHtml);
         msg.setContent(mimeAllContent);
         msg.setHeader("Content-Type" , mimeAllContent.getContentType());
         // SEND THE MESSAGE
         msg.saveChanges();
         Transport.send(msg);
         return true;
    Let me repeat - Using the code below, a HTML & Text ("Alternative"
    MimeMultiPart) message is sent, and arrives at the recipient's
    mailbox. When it is sent to one user ([email protected]), it never
    renders properly. When it is sent to another ([email protected]), it's
    OK. The destination server, email client, PC are the same in both
    cases and the only variable is the recipient's email address.
    How can this be ?
    I think I've gone overboard by setting the Content-Transfer-Encoding
    for both the HTML and Text MimeParts as well as the actual Message.
    Could somebody please confirm which parts I should set the Content-
    -Language, Content-Transfer-Encoding and Content-Type b/c I'm
    going in circles at the moment.
    Thanks indeed, to anybody who has experience sending doublebyte
    with Javamail and can help me clear this up once and for all.
    I find it incredible that after 3 years, there is still no
    definitive answer to accomplishing this, and it remains an
    elusive black art.
    Regards,
    chas
    ps. The data being sent is in MySQL not that that matters at all.

    Try adding code to validate submitted email addresses before they go into your database.
    String emailAddress = (from where ever)
    if(emailAddress != null) emailAddress = emailAddress.trim();
    if(emailAddress == null) // skip this address
    // I also check for a list of illegal internet email address characters, as I think the email addresses allowed by Javamail are too lenient.

  • Urgent: Out of message Exception when parsing large message with JavaMail

    I am using JavaMail to parse the message. If the size of the message I try to parse exceeds my memory setting, I will got the Out of memory error. I understand that, and it is reasonable.
    The question I have is: At the time I try to parse the message, I only want to know what the displayable text content of the message and some information about the attachement files like the attchment file name, file type, and file size. So I want to parse the message to get only those information without the body of the attachment files. In this case, I can avoid the "Out of memory" exception in most case. Is there anyway to do this with JavaMail 1.2?
    Thanks.

    Hi try to read only the header information of the mail it will give you the details

  • How to use gmail with JavaMail

    JavaMail 1.4 is capable of sending and reading messages using gmail.
    All that's required is to properly configure JavaMail. I'll
    illustrate the proper configuration using the demo programs that
    come with JavaMail - msgshow.java and smtpsend.java.
    Let's assume your gmail username is "[email protected]" and your
    password is "passwd".
    To read mail from your gmail Inbox, invoke msgshow as follows:
    java msgshow -D -T pop3s -H pop.gmail.com -U user -P passwdBy reading the msgshow.java source code, you can see how these
    command line arguments are used in the JavaMail API. You should
    first try using msgshow as shown above, and once that's working
    move on to writing and configuring your own program to use gmail.
    To send a message through gmail, invoke smtpsend as follows:
    java -Dmail.smtp.port=587 -Dmail.smtp.starttls.enable=true smtpsend
            -d -M smtp.gmail.com -U user -P passwd -A [email protected](Note that I split the command over two lines for display, but you
    should type it on one line.)
    The smtpsend command will prompt for a subject and message body text.
    End the message body with ^D on UNIX or ^Z on Windows.
    Gmail requires the use of the STARTTLS command, and requires a
    non-standard port, which the smtpsend program doesn't have command
    line options to select so we set them as System properties on the
    java command. The smtpsend.java program uses the System properties
    when creating the JavaMail Session, so the properties set on the
    command line will be available to the JavaMail Session.
    Again, you can read the smtpsend.java source code to see how the
    command line arguments are used in the JavaMail API. There is,
    of course, more than one way to use the JavaMail API to accomplish
    the same goal. This should help you understand the essential
    configuration parameters necessary to use gmail.
    And no, I won't send you an invitation to gmail. Sorry.

    I notice that it's possible to have sticky posts in these forums. See
    http://forum.java.sun.com/forum.jspa?forumID=534
    the Concurrency forum for an example. Posting a link to the FAQ in a sticky post might reduce the number of FAQs asked here by maybe 1%? Or posts like this one might do well as a sticky?

  • Creating users with javamail in cyrus

    Hi!
    please, help me!!! I'm in problems..
    I need to create users (accounts) with javamail in cyrus.. but I don't know how to do that... The connect method requires a user but which user I have to put there in this case?
    Can anybody give me a solution please?
    thanks!
    Kary

    Management issues are beyond the scope of JavaMail.

  • I Can't send a message with JavaMail

    I can't send mail with JavaMail. I Try send a e-mail, for example, to: [email protected], from: [email protected], my smtp: smtp.alunos.ufu.br, but when i try it, i received a message the e-mail [email protected] not in server smtp.alunos.ufu.br.
    I don't anderstend what happen. I need the alunos.ufu.br send my message to [email protected]
    Somebody can help me ?????

    I think the problem is that your smtp server smtp.alunos.ufu.br is not relaying to addresses not local to itself. Please post the exact stack trace. There is some 500 level error being returned by the server that will tell you exactly what is happening.

  • How to send "Blob" in mail Attacthemnt with Javamail

    Hi,
    I need send a mail with attach file that is stored in bd. The column is a BLOB (any file) , and i need send directly with JavaMail..
    Any idea or sample???
    Thanks

    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:255615160805

  • Reading exchange address book with javamail

    Hello guys
    does anybody know how to read an exchange server address book with javamail ?
    Thanks for any information

    I never think JavaMail could read the address book from exchange server.
    I think you should make sure if the exchange has a pai supporting this function
    java email verify
    http://www.wisesoft.biz/

  • Anyone have luck beating the new image spam with "rules"?

    Has anyone figured out how to write rules that block that very annoying new (dozen-message-per-day) image spam? The kind with "torn" bits that reassemble to defeat my ISP's spam-words filters?
    Personally, I favor the death penalty for the producers, and at least a cane lashing to anyone who replies, but since that's not going to happen in my lifetime, I want to banish this drivel from my box.
    I've tried a few things, but I'm not finding the magic bullet(s). These parasitic missives must have something in common that I can utilize to redirect the junk into electronic Gehenna.
    If there are no solutions in the Mac Mail rules settings, I'll probably make draconian changes in the settings my ISP provides, but that means I'll also be blocking a lot of mail I want.

    Rules for this kind of messages have been suggested in many places, including this forum, and Allan has already provided two examples.
    I personally believe such rules are a bad idea and a waste of time. IMO, the best way to deal with those messages is to just manually mark them as junk. Contrary to what many people think, Mail’s built-in junk filter can learn to recognize those messages as junk; it takes more time that with other types of junk, but it works pretty well. I don’t have any such rules set up in Mail, yet in my case the junk filter correctly marks almost all of them as junk without me having to do anything else.

  • Filtering spam on iPad

    Is there a spam filter on the iPad email? The email seems to be skipping spam detection coming to the iPad.
    Thanks
    Dan

    Hello,
    On my PC with Outlook i can create 2 reception boxes, one for people i allowed, one for other i did not allow yet.
    Then, spam messages are easily filtered and i can delete them all with one clic. And important messages are not mixed with hundreds of spams.
    Is that possible to do the same with iPad mail features. I did not find anything to do that in features menu
    I am surprised because it is obvious and essential feature...
    Djeecee - France

  • Filtering spam in iphone mail ??? !!!

    Well, the title is clear, I haven't found any way...
    As I have several accounts, I filter the spams in os X mail, instead in each mailbox whicj would be too complicated to manage... And then I badly need a filter in iphone !!!

    Thank you for your replies, but what you propose is exactly what I don't want (as I said in the initial post) :
    If Apple has offered the filter in mail, I guess it is :
    * for guys who don't know anything in computing,
    * or the opposite, for guys like me, who know a little in computing and have more that 5 accounts with 3 different providers : I don't want to bear the burden of setting up the filters in each account !
    I am affraid there is presently no solution...
    But I badly want to know when it will be done (I guess it will happen some day ! )
    If anybodu have a clue, I would be very happy...
    Thanks to apple to provide any good answer !... At least an estimated date

Maybe you are looking for