Package org.apache.james.util.scanner

Examples of org.apache.james.util.scanner.SpamAssassinInvoker


    public void service(Mail mail) {
        try {
            MimeMessage message = mail.getMessage();

            // Invoke spamassian connection and scan the message
            SpamAssassinInvoker sa = new SpamAssassinInvoker(spamdHost,
                    spamdPort);
            sa.scanMail(message);

            Iterator<String> headers = sa.getHeadersAsAttribute().keySet().iterator();

            // Add headers as attribute to mail object
            while (headers.hasNext()) {
                String key = headers.next();
                mail.setAttribute(key, (String) sa.getHeadersAsAttribute().get(key));
            }

            message.saveChanges();
        } catch (MessagingException e) {
            log(e.getMessage());
View Full Code Here


    public HookResult onMessage(SMTPSession session, Mail mail) {

    
        try {
            MimeMessage message = mail.getMessage();
            SpamAssassinInvoker sa = new SpamAssassinInvoker(spamdHost,
                    spamdPort);
            sa.scanMail(message);

            Iterator<String> headers = sa.getHeadersAsAttribute().keySet().iterator();

            // Add the headers
            while (headers.hasNext()) {
                String key = headers.next();

                mail.setAttribute(key, (String) sa.getHeadersAsAttribute().get(
                        key));
            }

            // Check if rejectionHits was configured
            if (spamdRejectionHits > 0) {
                try {
                    double hits = Double.parseDouble(sa.getHits());

                    // if the hits are bigger the rejectionHits reject the
                    // message
                    if (spamdRejectionHits <= hits) {
                        StringBuffer buffer = new StringBuffer(256).append(
View Full Code Here

    public void service(Mail mail) {
        try {
            MimeMessage message = mail.getMessage();

            // Invoke spamassian connection and scan the message
            SpamAssassinInvoker sa = new SpamAssassinInvoker(spamdHost, spamdPort);
            sa.scanMail(message);

            // Add headers as attribute to mail object
            for (String key : sa.getHeadersAsAttribute().keySet()) {
                mail.setAttribute(key, sa.getHeadersAsAttribute().get(key));
            }

            message.saveChanges();
        } catch (MessagingException e) {
            log(e.getMessage());
View Full Code Here

     */
    public HookResult onMessage(SMTPSession session, Mail mail) {

        try {
            MimeMessage message = mail.getMessage();
            SpamAssassinInvoker sa = new SpamAssassinInvoker(spamdHost, spamdPort);
            sa.scanMail(message);

            // Add the headers
            for (String key : sa.getHeadersAsAttribute().keySet()) {
                mail.setAttribute(key, sa.getHeadersAsAttribute().get(key));
            }

            // Check if rejectionHits was configured
            if (spamdRejectionHits > 0) {
                try {
                    double hits = Double.parseDouble(sa.getHits());

                    // if the hits are bigger the rejectionHits reject the
                    // message
                    if (spamdRejectionHits <= hits) {
                        String buffer = "Rejected message from " + session.getAttachment(SMTPSession.SENDER, State.Transaction).toString() + " from host " + session.getRemoteAddress().getHostName() + " (" + session.getRemoteAddress().getAddress().getHostAddress() + ") This message reach the spam hits treshold. Required rejection hits: " + spamdRejectionHits + " hits: " + hits;
View Full Code Here

TOP

Related Classes of org.apache.james.util.scanner.SpamAssassinInvoker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.