here is the code as it is now
// get the content(type) part
if (contentType.startsWith("text")) {
commEventMap.put("content", message.getContent());
commEventMap.put("contentMimeTypeId", contentType);
} else if (contentType.startsWith("multipart") ||
contentType.startsWith("Multipart")) {
contentIndex = "";
commEventMap = addMessageBody(commEventMap, (Multipart)
message.getContent());
}
Here is the code as I patched it. this was put in, apparently it was
removed.
int contentIndex = -1;
Multipart multipart = null;
if (contentType.startsWith("text")) {
content = (String)message.getContent();
commEventMap.put("contentMimeTypeId", contentType);
} else if (contentType.startsWith("multipart")) {
multipart = (Multipart)message.getContent();
int multipartCount = multipart.getCount();
for (int i=0; i < multipartCount; i++) {
Part part = multipart.getBodyPart(i);
String thisContentTypeRaw =
part.getContentType();
int idx2 = thisContentTypeRaw.indexOf(";");
String thisContentType =
thisContentTypeRaw.substring(0, idx2);
String disposition = part.getDisposition();
// See this case where the disposition of the
inline text is null
if ((disposition == null) && (i == 0) &&
thisContentType.startsWith("text"))
{
content = (String)part.getContent();
if (UtilValidate.isNotEmpty(content)) {
contentIndex = i;
commEventMap.put("contentMimeTypeId", thisContentType);
break;
}
} else if ((disposition != null)
&&
(disposition.equals(Part.ATTACHMENT) ||
disposition.equals(Part.INLINE))
&&
thisContentType.startsWith("text"))
{
content = (String)part.getContent();
contentIndex = i;
commEventMap.put("contentMimeTypeId",
thisContentType);
break;
}
}
}
commEventMap.put("content", content);
rohit2006 sent the following on 4/21/2007 12:24 AM:
> Yes, i have added [EMAIL PROTECTED] as email address of one of the parties.
>
>
> BJ Freeman wrote:
>> do you have a "[EMAIL PROTECTED]" in one of the parties in ofbiz
>>
>> rohit2006 sent the following on 4/20/2007 8:13 PM:
>>> i have changed the service to use the ofbiz service 'storeIncomingEmail',
>>> but
>>> that didn't help either. And as suspected by 'Guido Amarilla' i also
>>> included 'CC' in my test emails, but that did not work either.
>>>
>>> I can see that ofbiz reads the mail properly, but is not able to store
>>> the
>>> email.
>>>
>>> My javamail configuration is:
>>>
>>> <!-- JavaMail Listener Container - Triggers MCA Rules -->
>>> <!-- if delete-mail is set to true, will delete messages after
>>> fetching
>>> them. otherwise, will try to mark them as seen
>>> mail.store.protocol supports both imap and pop3, but pop3 will
>>> not
>>> be able to mark messages as seen, so you would need to delete them -->
>>> <!-- To use the mail listerner just uncomment and go... -->
>>> <container name="javamail-container"
>>> class="org.ofbiz.service.mail.JavaMailContainer">
>>> <property name="delegator-name" value="default"/>
>>> <property name="dispatcher-name" value="JavaMailDispatcher"/>
>>> <property name="run-as-user" value="system"/>
>>> <property name="poll-delay" value="300000"/>
>>> <property name="delete-mail" value="false"/>
>>> <property name="maxSize" value="100000"/>
>>> <property name="default-listener" value="store-listener">
>>> <property name="mail.store.protocol" value="pop3"/>
>>> <property name="mail.host" value="localhost"/>
>>> <property name="mail.user" value="userID"/>
>>> <property name="mail.pass" value="password"/>
>>> <property name="mail.debug" value="true"/>
>>> </property>
>>> </container>
>>>
>>> ERROR LOG -----------------
>>>
>>> "2007-04-20 20:59:18,079 (Thread-0) [ EmailServices.java:743:INFO ]
>>> Processing Incoming Email message from: Rohit Sureka
>>> <[EMAIL PROTECTED]> to: [EMAIL PROTECTED]
>>> 2007-04-20 20:59:18,154 (Thread-0) [ UtilXml.java:243:DEBUG]
>>> XML
>>> Read 0.047s:
>>> /ofbiz/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml
>>> 2007-04-20 20:59:18,253 (Thread-0) [ ServiceDispatcher.java:459:DEBUG]
>>> Sync
>>> service [JavaMailDispatcher/executeFind] finished in [79] milliseconds
>>> 2007-04-20 20:59:18,254 (Thread-0) [ ServiceDispatcher.java:459:DEBUG]
>>> Sync
>>> service [JavaMailDispatcher/performFindItem] finished in [83]
>>> milliseconds
>>> 2007-04-20 20:59:18,272 (Thread-0) [ ServiceDispatcher.java:459:DEBUG]
>>> Sync
>>> service [JavaMailDispatcher/findPartyFromEmailAddress] finished in [192]
>>> milliseconds
>>> 2007-04-20 20:59:18,354 (Thread-0) [ EmailServices.java:933:ERROR]
>>> ---- runtime exception report
>>> --------------------------------------------------
>>> Exception: java.lang.NullPointerException
>>> Message: null
>>> ---- stack trace
>>> ---------------------------------------------------------------
>>> java.lang.NullPointerException
>>> org.ofbiz.content.email.EmailServices.storeIncomingEmail(EmailServices.java:835)
>>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>> java.lang.reflect.Method.invoke(Method.java:324)
>>> org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker(StandardJavaEngine.java:91)
>>> org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java:53)
>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:336)
>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:211)
>>> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
>>> org.ofbiz.service.mail.ServiceMcaAction.runAction(ServiceMcaAction.java:58)
>>> org.ofbiz.service.mail.ServiceMcaRule.eval(ServiceMcaRule.java:97)
>>> org.ofbiz.service.mail.ServiceMcaUtil.evalRules(ServiceMcaUtil.java:120)
>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.processMessage(JavaMailContainer.java:334)
>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.checkMessages(JavaMailContainer.java:313)
>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.run(JavaMailContainer.java:262)
>>> java.util.TimerThread.mainLoop(Timer.java:432)
>>> java.util.TimerThread.run(Timer.java:382)
>>> --------------------------------------------------------------------------------
>>>
>>> 2007-04-20 20:59:18,355 (Thread-0) [ ServiceDispatcher.java:411:ERROR]
>>> Service Error [storeIncomingEmail]:
>>> 2007-04-20 20:59:18,356 (Thread-0) [ TransactionUtil.java:252:ERROR]
>>> ---- exception report
>>> ----------------------------------------------------------
>>> [TransactionUtil.rollback]
>>> Exception: java.lang.Exception
>>> Message: Stack Trace
>>> ---- stack trace
>>> ---------------------------------------------------------------
>>> java.lang.Exception: Stack Trace
>>> org.ofbiz.entity.transaction.TransactionUtil.rollback(TransactionUtil.java:251)
>>> org.ofbiz.entity.transaction.TransactionUtil.rollback(TransactionUtil.java:233)
>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:415)
>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:211)
>>> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
>>> org.ofbiz.service.mail.ServiceMcaAction.runAction(ServiceMcaAction.java:58)
>>> org.ofbiz.service.mail.ServiceMcaRule.eval(ServiceMcaRule.java:97)
>>> org.ofbiz.service.mail.ServiceMcaUtil.evalRules(ServiceMcaUtil.java:120)
>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.processMessage(JavaMailContainer.java:334)
>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.checkMessages(JavaMailContainer.java:313)
>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.run(JavaMailContainer.java:262)
>>> java.util.TimerThread.mainLoop(Timer.java:432)
>>> java.util.TimerThread.run(Timer.java:382)
>>> --------------------------------------------------------------------------------
>>>
>>> 2007-04-20 20:59:18,357 (Thread-0) [ TransactionUtil.java:262:INFO ]
>>> [TransactionUtil.rollback] transaction rolled back
>>> 2007-04-20 20:59:18,358 (Thread-0) [ ServiceDispatcher.java:459:DEBUG]
>>> Sync
>>> service [JavaMailDispatcher/storeIncomingEmail] finished in [303]
>>> milliseconds
>>> 2007-04-20 20:59:18,358 (Thread-0) [ ServiceMcaAction.java:60 :ERROR]
>>>
>>>
>>>
>>> BJ Freeman wrote:
>>>> what I see first is you are using the crmsfa.processIncomingEmail
>>>> so this is best ask in the opentaps forum.
>>>>
>>>>
>>>> rohit2006 sent the following on 4/20/2007 12:11 PM:
>>>>> i was just trying to record communication even when a email was
>>>>> received.
>>>>> I
>>>>> had done the MCA rules incorrectly, but i guess they are not set OK.
>>>>>
>>>>> My MCA settings are:
>>>>>
>>>>> <service-mca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>
>>>>> xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/service-mca.xsd">
>>>>> <mca mail-rule-name="processIncomingEmail">
>>>>> <!-- the matching is a regular expression match against the
>>>>> email
>>>>> address. this format seems to work for
>>>>> both "[EMAIL PROTECTED]" and "Mr. XYZ <[EMAIL PROTECTED]>" -->
>>>>> <condition-field field-name="to" operator="matches"
>>>>> value="[EMAIL PROTECTED]"/>
>>>>> <action service="crmsfa.processIncomingEmail" mode="sync"/>
>>>>> </mca>
>>>>> </service-mca>
>>>>>
>>>>>
>>>>> The crmsfa.processincomingemail is defined as follows:
>>>>>
>>>>> <service name="crmsfa.processIncomingEmail" engine="java"
>>>>> location="com.opensourcestrategies.crmsfa.activities.ActivitiesServices"
>>>>> invoke="processIncomingEmail">
>>>>> <description>Process an incoming email by calling
>>>>> storeIncomingEmail
>>>>> to create a CommunicationEvent wrapped in a WorkEffort. This WorkEffort
>>>>> is
>>>>> then
>>>>> associated with the partyIdFrom of the
>>>>> CommunicationEvent.</description>
>>>>> <attribute name="messageWrapper"
>>>>> type="org.ofbiz.service.mail.MimeMessageWrapper" mode="IN"/>
>>>>> </service>
>>>>>
>>>>> However the incoming mails are not being processed and i am getting
>>>>> these
>>>>> errors:
>>>>>
>>>>> 2007-04-20 12:44:03,137 (Thread-0) [ EmailServices.java:743:INFO ]
>>>>> Processing Incoming Email message from: Rohit Sureka
>>>>> <[EMAIL PROTECTED]>
>>>>> to: [EMAIL PROTECTED]
>>>>> 2007-04-20 12:44:03,170 (Thread-0) [ EmailServices.java:933:ERROR]
>>>>> ---- runtime exception report
>>>>> --------------------------------------------------
>>>>> Exception: java.lang.NullPointerException
>>>>> Message: null
>>>>> ---- stack trace
>>>>> ---------------------------------------------------------------
>>>>> java.lang.NullPointerException
>>>>> org.ofbiz.content.email.EmailServices.storeIncomingEmail(EmailServices.java:835)
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>> java.lang.reflect.Method.invoke(Method.java:324)
>>>>> org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker(StandardJavaEngine.java:91)
>>>>> org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java:53)
>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:336)
>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:211)
>>>>> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
>>>>> com.opensourcestrategies.crmsfa.activities.ActivitiesServices.processIncomingEmail(ActivitiesServices.java:309)
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>> java.lang.reflect.Method.invoke(Method.java:324)
>>>>> org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker(StandardJavaEngine.java:91)
>>>>> org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java:53)
>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:336)
>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:211)
>>>>> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
>>>>> org.ofbiz.service.mail.ServiceMcaAction.runAction(ServiceMcaAction.java:58)
>>>>> org.ofbiz.service.mail.ServiceMcaRule.eval(ServiceMcaRule.java:97)
>>>>> org.ofbiz.service.mail.ServiceMcaUtil.evalRules(ServiceMcaUtil.java:120)
>>>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.processMessage(JavaMailContainer.java:334)
>>>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.checkMessages(JavaMailContainer.java:313)
>>>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.run(JavaMailContainer.java:262)
>>>>> java.util.TimerThread.mainLoop(Timer.java:432)
>>>>> java.util.TimerThread.run(Timer.java:382)
>>>>> --------------------------------------------------------------------------------
>>>>>
>>>>> 2007-04-20 12:44:03,171 (Thread-0) [ ServiceDispatcher.java:411:ERROR]
>>>>> Service Error [storeIncomingEmail]:
>>>>> 2007-04-20 12:44:03,172 (Thread-0) [ TransactionUtil.java:285:WARN ]
>>>>> ---- exception report
>>>>> ----------------------------------------------------------
>>>>> [TransactionUtil.setRollbackOnly] Calling transaction setRollbackOnly;
>>>>> this
>>>>> stack trace shows where this is happening:
>>>>> Exception: java.lang.Exception
>>>>> Message: Service Error [storeIncomingEmail]:
>>>>> ---- stack trace
>>>>> ---------------------------------------------------------------
>>>>> java.lang.Exception: Service Error [storeIncomingEmail]:
>>>>> org.ofbiz.entity.transaction.TransactionUtil.setRollbackOnly(TransactionUtil.java:285)
>>>>> org.ofbiz.entity.transaction.TransactionUtil.rollback(TransactionUtil.java:235)
>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:415)
>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:211)
>>>>> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
>>>>> com.opensourcestrategies.crmsfa.activities.ActivitiesServices.processIncomingEmail(ActivitiesServices.java:309)
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>> java.lang.reflect.Method.invoke(Method.java:324)
>>>>> org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker(StandardJavaEngine.java:91)
>>>>> org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java:53)
>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:336)
>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:211)
>>>>> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
>>>>> org.ofbiz.service.mail.ServiceMcaAction.runAction(ServiceMcaAction.java:58)
>>>>> org.ofbiz.service.mail.ServiceMcaRule.eval(ServiceMcaRule.java:97)
>>>>> org.ofbiz.service.mail.ServiceMcaUtil.evalRules(ServiceMcaUtil.java:120)
>>>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.processMessage(JavaMailContainer.java:334)
>>>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.checkMessages(JavaMailContainer.java:313)
>>>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.run(JavaMailContainer.java:262)
>>>>> java.util.TimerThread.mainLoop(Timer.java:432)
>>>>> java.util.TimerThread.run(Timer.java:382)
>>>>> --------------------------------------------------------------------------------
>>>>>
>>>>> 2007-04-20 12:44:03,173 (Thread-0) [ UtilCommon.java:127:ERROR]
>>>>> Failed to process incoming email:
>>>>> 2007-04-20 12:44:03,173 (Thread-0) [ ServiceDispatcher.java:411:ERROR]
>>>>> Service Error [crmsfa.processIncomingEmail]: Failed to process incoming
>>>>> email:
>>>>> 2007-04-20 12:44:03,174 (Thread-0) [ TransactionUtil.java:252:ERROR]
>>>>> ---- exception report
>>>>> ----------------------------------------------------------
>>>>> [TransactionUtil.rollback]
>>>>> Exception: java.lang.Exception
>>>>> Message: Stack Trace
>>>>> ---- stack trace
>>>>> ---------------------------------------------------------------
>>>>> java.lang.Exception: Stack Trace
>>>>> org.ofbiz.entity.transaction.TransactionUtil.rollback(TransactionUtil.java:251)
>>>>> org.ofbiz.entity.transaction.TransactionUtil.rollback(TransactionUtil.java:233)
>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:415)
>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:211)
>>>>> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
>>>>> org.ofbiz.service.mail.ServiceMcaAction.runAction(ServiceMcaAction.java:58)
>>>>> org.ofbiz.service.mail.ServiceMcaRule.eval(ServiceMcaRule.java:97)
>>>>> org.ofbiz.service.mail.ServiceMcaUtil.evalRules(ServiceMcaUtil.java:120)
>>>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.processMessage(JavaMailContainer.java:334)
>>>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.checkMessages(JavaMailContainer.java:313)
>>>>> org.ofbiz.service.mail.JavaMailContainer$PollerTask.run(JavaMailContainer.java:262)
>>>>> java.util.TimerThread.mainLoop(Timer.java:432)
>>>>> java.util.TimerThread.run(Timer.java:382)
>>>>> --------------------------------------------------------------------------------
>>>>>
>>>>> 2007-04-20 12:44:03,175 (Thread-0) [ TransactionUtil.java:262:INFO ]
>>>>> [TransactionUtil.rollback] transaction rolled back
>>>>> 2007-04-20 12:44:03,176 (Thread-0) [ ServiceMcaAction.java:60 :ERROR]
>>>>> Failed to process incoming email:
>>>>> C: QUIT
>>>>> S: +OK Logging out.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> BJ Freeman wrote:
>>>>>> could you be more specific about what you are trying to sort?
>>>>>> would this be better served as a entity view?
>>>>>>
>>>>>> Rohit Sureka sent the following on 4/20/2007 9:32 AM:
>>>>>>> Thanks for the email and i am sorry if i did not put my question
>>>>>>> properly.
>>>>>>>
>>>>>>> My real problem is configuring the service to sort emails. I have put
>>>>>>> the
>>>>>>> MCA rules in place but i am not able to configure the
>>>>>>> "sortincomingemail'
>>>>>>> service.
>>>>>>>
>>>>>>> I understand that "sortincomingemail" has to be run at regular
>>>>>>> interval
>>>>>>> to process the email sorting.
>>>>>>>
>>>>>>> Rohit
>>>>>>>
>>>>>>> BJ Freeman <[EMAIL PROTECTED]> wrote: My previous response was
>>>>>>> aimed
>>>>>>> at
>>>>>>> sorting the communication events after
>>>>>>> they have been already loaded.
>>>>>>>
>>>>>>> to answer your question, Yes ofbiz will try to match any email to and
>>>>>>> from with those in the parties.
>>>>>>> if it can not find one of the parties, usually the from, it puts the
>>>>>>> address in comments, an marks it unknown email address.
>>>>>>>
>>>>>>>
>>>>>>> The MCA is used to filter the emails. Like:
>>>>>>>
>>>>>>> link tracking number to order-->
>>>>>>>
>>>>>>>
>>>>>>> value="[EMAIL PROTECTED]"/>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> in the above I am rerouting the Quantum emails to a process I wrote
>>>>>>> to
>>>>>>> input the shipping tracking number into an order.
>>>>>>>
>>>>>>> If this is what you were meaning by sort then this is the mechanism
>>>>>>> to
>>>>>>> to this.
>>>>>>>
>>>>>>> you can find /framework/common/servicedef/smca_test.xml
>>>>>>>
>>>>>>>
>>>>>>> rohit2006 sent the following on 4/19/2007 10:03 PM:
>>>>>>>> i am trying to configure email sorting in ofbiz. I have followed the
>>>>>>>> documentation by Si Chen, to test it. I am assuming that if email
>>>>>>>> sorting is
>>>>>>>> correctly configured, emails will be recorded as communication event
>>>>>>>> for
>>>>>>>> the
>>>>>>>> related parties. For eg. after a email is received ofbiz, will try
>>>>>>>> to
>>>>>>>> match
>>>>>>>> the "to" address, with the email associated to a party, and if a
>>>>>>>> match
>>>>>>>> is
>>>>>>>> found, a communication event will be logged for the party.
>>>>>>>>
>>>>>>>> I hope that i got this right?
>>>>>>>>
>>>>>>>> I have followed the instruction as mentioned in documentation, and
>>>>>>>> everything loads fine, but when i schedule the service
>>>>>>>> storeincomingemail, i
>>>>>>>> am prompted to enter the service parameter(messageWrapper
>>>>>>>> (org.ofbiz.service.mail.MimeMessageWrapper), which i have no clue
>>>>>>>> about.
>>>>>>>> i
>>>>>>>> guess this is to do something 'MimeMessageWrapper'.
>>>>>>>>
>>>>>>>> The documentation by Si Chen mentions this:
>>>>>>>>
>>>>>>>> 5. MCA services need to implement the mail processing interface, as
>>>>>>>> in:
>>>>>>>>
>>>>>>>> It uses a MimeMessageWrapper:
>>>>>>>> MimeMessageWrapper wrapper = (MimeMessageWrapper)
>>>>>>>> context.get("messageWrapper");
>>>>>>>> MimeMessage message = wrapper.getMessage();
>>>>>>>> with methods like message.getAllRecipients(), message.getFrom(),
>>>>>>>> message.getSubject(), getAllRecipients(), getSentDate(),
>>>>>>>> getReceivedDate(),
>>>>>>>> etc.
>>>>>>>>
>>>>>>>> Currently (20060607) there is a service called
>>>>>>>> “storeIncomingEmailâ€
>>>>>>>> which
>>>>>>>> could be used to do inbound mail sorting. This has not been fully
>>>>>>>> tested
>>>>>>>> yet.
>>>>>>>>
>>>>>>>>
>>>>>>>> I am not sure what to insert in the service parameters.
>>>>>>>>
>>>>>>>> Do we need to create a view for email sorting, cause i think the
>>>>>>>> mails
>>>>>>>> will
>>>>>>>> be visible, under the communication tab, in party manager?
>>>>>>>>
>>>>>>>> Rohit
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> BJ Freeman wrote:
>>>>>>>>> If I understand you, you can create a view with the sorting you
>>>>>>>>> want.
>>>>>>>>>
>>>>>>>>> rohit2006 sent the following on 4/19/2007 4:33 AM:
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I am trying configure email sorting in ofbiz and store emails as
>>>>>>>>>> communication events. I believe i have to schedule the service
>>>>>>>>>> storeIncomingEmail as a service. I tried to do that and was
>>>>>>>>>> prompted
>>>>>>>>>> fill
>>>>>>>>>> the fields:
>>>>>>>>>>
>>>>>>>>>> Step 2: Service Parameters
>>>>>>>>>> messageWrapper (org.ofbiz.service.mail.MimeMessageWrapper).
>>>>>>>>>>
>>>>>>>>>> I am not sure what to enter into this field, can someone please
>>>>>>>>>> help
>>>>>>>>>> me
>>>>>>>>>> configure this. I am getting the following error in log when the
>>>>>>>>>> service
>>>>>>>>>> is
>>>>>>>>>> run
>>>>>>>>>>
>>>>>>>>>> 2007-04-19 05:22:31,302 (default-invoker-Thread-2) [
>>>>>>>>>> JobInvoker.java:211:INFO ] Invoker: default-invoker-Thread-2
>>>>>>>>>> received
>>>>>>>>>> job
>>>>>>>>>> --
>>>>>>>>>> 1176985293330 from poller -
>>>>>>>>>> [EMAIL PROTECTED]
>>>>>>>>>> 2007-04-19 05:22:31,320 (default-invoker-Thread-2)
>>>>>>>>>> [PersistedServiceJob.java:136:INFO ]
>>>>>>>>>> [EMAIL PROTECTED] -- Next
>>>>>>>>>> runtime:
>>>>>>>>>> -1
>>>>>>>>>> [Error] :2:12: cvc-elt.1: Cannot find the declaration of element
>>>>>>>>>> 'ofbiz-ser'.
>>>>>>>>>> 2007-04-19 05:22:31,331 (default-invoker-Thread-2) [
>>>>>>>>>> UtilXml.java:243:DEBUG] XML Read 0.0040s: Internal Content
>>>>>>>>>> 2007-04-19 05:22:31,332 (default-invoker-Thread-2) [
>>>>>>>>>> ServiceDispatcher.java:322:ERROR]
>>>>>>>>>> ---- exception report
>>>>>>>>>> ----------------------------------------------------------
>>>>>>>>>> Incoming context (in runSync : storeIncomingEmail) does not match
>>>>>>>>>> expected
>>>>>>>>>> requirements
>>>>>>>>>> Exception: org.ofbiz.service.ServiceValidationException
>>>>>>>>>> Message: The following required parameter is missing:
>>>>>>>>>> [storeIncomingEmail.messageWrapper]
>>>>>>>>>> ---- stack trace
>>>>>>>>>> ---------------------------------------------------------------
>>>>>>>>>> org.ofbiz.service.ServiceValidationException: The following
>>>>>>>>>> required
>>>>>>>>>> parameter is missing: [storeIncomingEmail.messageWrapper]
>>>>>>>>>> org.ofbiz.service.ModelService.validate(ModelService.java:452)
>>>>>>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:320)
>>>>>>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:211)
>>>>>>>>>> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
>>>>>>>>>> org.ofbiz.service.job.GenericServiceJob.exec(GenericServiceJob.java:70)
>>>>>>>>>> org.ofbiz.service.job.JobInvoker.run(JobInvoker.java:221)
>>>>>>>>>> java.lang.Thread.run(Thread.java:534)
>>>>>>>>>> --------------------------------------------------------------------------------
>>>>>>>>>>
>>>>>>>>>> 2007-04-19 05:22:31,333 (default-invoker-Thread-2) [
>>>>>>>>>> ServiceDispatcher.java:385:DEBUG] [[Sync service failed...-
>>>>>>>>>> total:0.0,since
>>>>>>>>>> last(Begin):0.0]] - 'JobDispatcher / storeIncomingEmail'
>>>>>>>>>> 2007-04-19 05:22:31,333 (default-invoker-Thread-2) [
>>>>>>>>>> ServiceDispatcher.java:388:ERROR]
>>>>>>>>>> ---- exception report
>>>>>>>>>> ----------------------------------------------------------
>>>>>>>>>> Service [storeIncomingEmail] threw an unexpected exception/error
>>>>>>>>>> Exception: org.ofbiz.service.ServiceValidationException
>>>>>>>>>> Message: The following required parameter is missing:
>>>>>>>>>> [storeIncomingEmail.messageWrapper]
>>>>>>>>>> ---- stack trace
>>>>>>>>>> ---------------------------------------------------------------
>>>>>>>>>> org.ofbiz.service.ServiceValidationException: The following
>>>>>>>>>> required
>>>>>>>>>> parameter is missing: [storeIncomingEmail.messageWrapper]
>>>>>>>>>> org.ofbiz.service.ModelService.validate(ModelService.java:452)
>>>>>>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:320)
>>>>>>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:211)
>>>>>>>>>> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
>>>>>>>>>> org.ofbiz.service.job.GenericServiceJob.exec(GenericServiceJob.java:70)
>>>>>>>>>> org.ofbiz.service.job.JobInvoker.run(JobInvoker.java:221)
>>>>>>>>>> java.lang.Thread.run(Thread.java:534)
>>>>>>>>>> --------------------------------------------------------------------------------
>>>>>>>>>>
>>>>>>>>>> 2007-04-19 05:22:31,334 (default-invoker-Thread-2) [
>>>>>>>>>> TransactionUtil.java:252:ERROR]
>>>>>>>>>> ---- exception report
>>>>>>>>>> ----------------------------------------------------------
>>>>>>>>>> [TransactionUtil.rollback]
>>>>>>>>>> Exception: java.lang.Exception
>>>>>>>>>> Message: Stack Trace
>>>>>>>>>> ---- stack trace
>>>>>>>>>> ---------------------------------------------------------------
>>>>>>>>>> java.lang.Exception: Stack Trace
>>>>>>>>>> org.ofbiz.entity.transaction.TransactionUtil.rollback(TransactionUtil.java:251)
>>>>>>>>>> org.ofbiz.entity.transaction.TransactionUtil.rollback(TransactionUtil.java:233)
>>>>>>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:391)
>>>>>>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:211)
>>>>>>>>>> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
>>>>>>>>>> org.ofbiz.service.job.GenericServiceJob.exec(GenericServiceJob.java:70)
>>>>>>>>>> org.ofbiz.service.job.JobInvoker.run(JobInvoker.java:221)
>>>>>>>>>> java.lang.Thread.run(Thread.java:534)
>>>>>>>>>> --------------------------------------------------------------------------------
>>>>>>>>>>
>>>>>>>>>> 2007-04-19 05:22:31,335 (default-invoker-Thread-2) [
>>>>>>>>>> TransactionUtil.java:262:INFO ] [TransactionUtil.rollback]
>>>>>>>>>> transaction
>>>>>>>>>> rolled back
>>>>>>>>>> 2007-04-19 05:22:31,335 (default-invoker-Thread-2) [
>>>>>>>>>> TransactionUtil.java:189:INFO ] [TransactionUtil.commit] Not
>>>>>>>>>> committing
>>>>>>>>>> transaction, status is STATUS_NO_TRANSACTION
>>>>>>>>>> 2007-04-19 05:22:31,336 (default-invoker-Thread-2) [
>>>>>>>>>> GenericServiceJob.java:117:ERROR]
>>>>>>>>>> ---- exception report
>>>>>>>>>> ----------------------------------------------------------
>>>>>>>>>> Async-Service failed.
>>>>>>>>>> Exception: org.ofbiz.service.ServiceValidationException
>>>>>>>>>> Message: The following required parameter is missing:
>>>>>>>>>> [storeIncomingEmail.messageWrapper]
>>>>>>>>>> ---- stack trace
>>>>>>>>>> ---------------------------------------------------------------
>>>>>>>>>> org.ofbiz.service.ServiceValidationException: The following
>>>>>>>>>> required
>>>>>>>>>> parameter is missing: [storeIncomingEmail.messageWrapper]
>>>>>>>>>> org.ofbiz.service.ModelService.validate(ModelService.java:452)
>>>>>>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:320)
>>>>>>>>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:211)
>>>>>>>>>> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
>>>>>>>>>> org.ofbiz.service.job.GenericServiceJob.exec(GenericServiceJob.java:70)
>>>>>>>>>> org.ofbiz.service.job.JobInvoker.run(JobInvoker.java:221)
>>>>>>>>>> java.lang.Thread.run(Thread.java:534)
>>>>>>>>>> --------------------------------------------------------------------------------
>>>>>>>>>>
>>>>>>>>>> 2007-04-19 05:22:31,342 (default-invoker-Thread-2) [
>>>>>>>>>> SequenceUtil.java:254:INFO ] Got bank of sequenced IDs for
>>>>>>>>>> [JobSandbox];
>>>>>>>>>> curSeqId=58370, maxSeqId=58380, bankSize=10
>>>>>>>>>> 2007-04-19 05:22:31,348 (default-invoker-Thread-2)
>>>>>>>>>> [PersistedServiceJob.java:202:INFO ] Persisted Job [58369] Failed
>>>>>>>>>> Re-Scheduling : 1176985531339
>>>>>>>>>> 2007-04-19 05:22:37,711 (http-0.0.0.0-7443-Processor1) [
>>>>>>>>>> ContextFilter.java:182:INFO ] [Request]: /webtools/control/jobList
>>>>>>>>>> 2007-04-19 05:22:37,712 (http-0.0.0.0-7443-Processor1) [
>>>>>>>>>> ControlServlet.java:90 :INFO ] The character encoding of the
>>>>>>>>>> request
>>>>>>>>>> is:
>>>>>>>>>> [null]. The character encoding we will use for the request and
>>>>>>>>>> response
>>>>>>>>>> is:
>>>>>>>>>> [UTF-8]
>>>>>>>>>> 2007-04-19 05:22:37,713 (http-0.0.0.0-7443-Processor1) [
>>>>>>>>>> ControlServlet.java:126:DEBUG] [[[jobList] Servlet Starting, doing
>>>>>>>>>> setup-
>>>>>>>>>> total:0.0,since last(Begin):0.0]]
>>>>>>>>>> 2007-04-19 05:22:37,714 (http-0.0.0.0-7443-Processor1) [
>>>>>>>>>> ControlServlet.java:181:DEBUG] [[[jobList] Setup done, doing
>>>>>>>>>> Event(s)
>>>>>>>>>> and
>>>>>>>>>> View(s)- total:0.0,since last([jobList] Servlet...):0.0]]
>>>>>>>>>> 2007-04-19 05:22:37,714 (http-0.0.0.0-7443-Processor1) [
>>>>>>>>>> RequestHandler.java:266:INFO ] [Processing Request]: jobList
>>>>>>>>>> sessionId=1508B221763B3DC07A253921591B5DA1.jvm1
>>>>>>>>>> 2007-04-19 05:22:37,715 (http-0.0.0.0-7443-Processor1) [
>>>>>>>>>> RequestManager.java:117:INFO ]
>>>>>>>>>> [RequestManager.getRequestAttribute]
>>>>>>>>>> Value
>>>>>>>>>> for attribute "null" of uri "jobList" not found
>>>>>>>>>> 2007-04-19 05:22:37,716 (http-0.0.0.0-7443-Processor1) [
>>>>>>>>>> RequestHandler.java:450:INFO ] [RequestHandler.doRequest]:
>>>>>>>>>> Response
>>>>>>>>>> is
>>>>>>>>>> a
>>>>>>>>>> view. sessionId=1508B221763B3DC07A253921591B5DA1.jvm1
>>>>>>>>>> 2007-04-19 05:22:37,716 (http-0.0.0.0-7443-Processor1) [
>>>>>>>>>> RequestHandler.java:603:INFO ] servletName=control, view=jobList
>>>>>>>>>> sessionId=1508B221763B3DC07A253921591B5DA1.jvm1
>>>>>>>>>> 2007-04-19 05:22:37,717 (http-0.0.0.0-7443-Processor1) [
>>>>>>>>>> ScreenRenderer.java:220:INFO ] Found servlet context (application)
>>>>>>>>>> attribute
>>>>>>>>>> that conflicts with parameter name, leaving request parameter in
>>>>>>>>>> place
>>>>>>>>>> for
>>>>>>>>>> name: _REQUEST_HANDLER_
>>>>>>>>>> 2007-04-19 05:22:37,826 (http-0.0.0.0-7443-Processor1) [
>>>>>>>>>> ModelScreenWidget.java:361:INFO ] In the include-screen tag the
>>>>>>>>>> screen
>>>>>>>>>> name
>>>>>>>>>> was empty, ignoring include; in screen [GlobalDecorator]
>>>>>>>>>> 2007-04-19 05:22:37,857 (http-0.0.0.0-7443-Processor1) [
>>>>>>>>>> ControlServlet.java:256:DEBUG] [[[jobList] Done rendering page,
>>>>>>>>>> Servlet
>>>>>>>>>> Finished- total:0.143,since last([jobList] Setup d...):0.143]]
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------
>>>>>>> Ahhh...imagining that irresistible "new car" smell?
>>>>>>> Check outnew cars at Yahoo! Autos.
>>>>
>>
>>
>