Author: hansbak
Date: Tue Sep 26 02:18:01 2006
New Revision: 449959
URL:
http://svn.apache.org/viewvc?view=rev&rev=449959Log:
added spam checking from an external spam checker when importing email
Modified:
incubator/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java
Modified: incubator/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java
URL:
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java?view=diff&rev=449959&r1=449958&r2=449959==============================================================================
--- incubator/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java (original)
+++ incubator/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java Tue Sep 26 02:18:01 2006
@@ -702,8 +702,20 @@
Address [] addressesFrom = message.getFrom();
Address [] addressesTo = message.getRecipients(MimeMessage.RecipientType.TO);
Address [] addressesCC = message.getRecipients(MimeMessage.RecipientType.CC);
- Address [] addressesBCC = message.getRecipients(MimeMessage.RecipientType.BCC);
-
+ Address [] addressesBCC = message.getRecipients(MimeMessage.RecipientType.BCC);
+
+ // ignore the message when the spam status = yes
+ String spamHeaderName = UtilProperties.getPropertyValue("general.properties", "mail.spam.name", "N");
+ String configHeaderValue = UtilProperties.getPropertyValue("general.properties", "mail.spam.value");
+ // only execute when config file has been set && header variable found
+ if (!spamHeaderName.equals("N") && message.getHeader(spamHeaderName) != null) {
+ String msgHeaderValue = message.getHeader(spamHeaderName)[0];
+ if(msgHeaderValue != null && msgHeaderValue.startsWith(configHeaderValue)) {
+ Debug.logInfo("Incoming Email message ignored, was detected by external spam checker", module);
+ ServiceUtil.returnSuccess();
+ }
+ }
+
result = getParyInfoFromEmailAddress(addressesFrom, userLogin, dispatcher);
partyIdFrom = (String)result.get("partyId");
contactMechIdFrom = (String)result.get("contactMechId");
@@ -779,11 +791,12 @@
} else {
// create a task to find party for email
commEventMap.put("statusId", "COM_UNKNOWN_PARTY");
- commNote = "Sent from: " + UtilMisc.toListArray(addressesFrom);
+ commNote = "Sent from: " + UtilMisc.toListArray(addressesFrom).toString();
}
if (partyIdTo == null) {
- commNote += "Sent to: " + UtilMisc.toListArray(addressesTo);
+ commNote += "Sent to: " + UtilMisc.toListArray(addressesTo).toString();
}
+
if (!("".equals(commNote))) {
commEventMap.put("note", commNote);
}