You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2006/12/12 00:02:26 UTC

Help on sendMail called by custom createCommunicationEvent SECA

Hi OFBizians,

I have created a custom createCommunicationEvent SECA on the model of 
original createCommunicationEvent

<eca service="createCommunicationEvent" event="commit">
    <condition field-name="partyIdTo" operator="is-not-empty"/>
    <condition field-name="subject" operator="contains" value="Problem 
packing order"/>
    <condition field-name="contactMechTypeId" operator="equals" 
value="EMAIL_ADDRESS"/>
    <action service="sendCommEventAsEmail" mode="sync"/>
</eca>

It seems to work (no error msgs, no exceptions) but no msg is actually sent 
(other std msgs are working well)

I have added these lines in EmailServices.sendMail()

String msg = "Send email message to [" + sendTo + "] from [" + sendFrom + "] 
cc [" + sendCc + "] bcc [" + sendBcc + "] subject [" + subject + "]";
Debug.logInfo(msg, module);
Debug.logInfo("Email message have been be sent to [" + sendTo + "] had 
context: " + context, module);

just after :

trans.sendMessage(mail, mail.getAllRecipients());

And I get following in the log.

2006-12-11 23:28:51,703 [     ServiceEcaRule.java:134 :INFO ] Running 
Service ECA Service: sendCommEventAsEmail, triggered by rule on Service: 
createCommunicationEvent
2006-12-11 23:28:51,796 [     RequestHandler.java:395 :INFO ] 
[RequestHandler.doRequest]: Response is a view.
2006-12-11 23:28:51,796 [     RequestHandler.java:547 :INFO ] 
servletName=control, view=PackOrder
2006-12-11 23:28:51,796 [     UtilJ2eeCompat.java:77  :INFO ] serverInfo: 
Apache Tomcat/5.5.9
2006-12-11 23:28:51,796 [     UtilJ2eeCompat.java:86  :INFO ] Apache Tomcat 
detected, using response.getWriter to write text out instead of 
response.getOutputStream
2006-12-11 23:28:52,078 [         JobInvoker.java:221 :INFO ] Invoker: 
default-invoker-Thread-9 received job -- 1165876131718 from poller - 
org.ofbiz.service.job.JobPoller@d22462
2006-12-11 23:28:52,156 [      EmailServices.java:149 :INFO ] Attempting to 
sent email to: orgcs@les7arts.com
2006-12-11 23:28:52,937 [      EmailServices.java:259 :INFO ] Send email 
message to [orgcs@les7arts.com] from [ofbiztest@yahoo.com] cc [null] bcc 
[null] subject [Problem packing order  #ORG13266 [To: orgcs
@les7arts.com, Cc: null, Bcc: null]]
2006-12-11 23:28:52,937 [      EmailServices.java:260 :INFO ] Email message 
have been be sent to [orgcs@les7arts.com] had context: {locale=en_FR, 
partyId=externaluser, sendTo=orgcs@les7arts.com, commun
icationEventId=15451, 
userLogin=[GenericEntity:UserLogin][createdStamp,2006-10-26 
12:55:38.0(java.sql.Timestamp)][createdTxStamp,2006-10-26 
12:55:38.0(java.sql.Timestamp)][currentPassword
,47ca69ebb4bdc9ae0adec130880165d2cc05db1a(java.lang.String)][disabledDateTime,null()][enabled,Y(java.lang.String)][hasLoggedOut,N(java.lang.String)][isSystem,null()][lastCurrencyUom,null()][lastLocale,en(java
.lang.String)][lastUpdatedStamp,2006-12-10 
18:28:15.0(java.sql.Timestamp)][lastUpdatedTxStamp,2006-12-10 
18:28:15.0(java.sql.Timestamp)][partyId,admin(java.lang.String)][passwordHint,mdp 
std(java.lang.String)
][successiveFailedLogins,0(java.lang.Long)][userLoginId,admin(java.lang.String)], 
subject=Problem packing order  #ORG13266, sendFrom=ofbiztest@yahoo.com, 
contentType=null, body=test}
2006-12-11 23:28:52,937 [     ServiceEcaRule.java:134 :INFO ] Running 
Service ECA Service: storeEmailAsCommunication, triggered by rule on 
Service: sendMail
2006-12-11 23:28:52,953 [     ServiceEcaRule.java:134 :INFO ] Running 
Service ECA Service: setCommEventComplete, triggered by rule on Service: 
sendCommEventAsEmail
2006-12-11 23:28:53,031 [     ServiceEcaRule.java:118 :INFO ] Got false for 
condition: [null][][statusId][equals][null][COM_IN_PROGRESS][true][String][]
2006-12-11 23:28:53,031 [     ServiceEcaRule.java:118 :INFO ] Got false for 
condition: [null][][statusId][equals][null][COM_IN_PROGRESS][true][String][]

So the message seems well sent but nothing happen. Due to 2 last lines I 
suspect to have done something  wrong in the ECA/SECA chain but I can't see 
what. Also despite my desesperate efforts I can't get contentType set to 
"text/html". This should be default, I also tried to force it, nope.

Somebody an idea ?

Thanks

Jacques 


Re: Help on sendMail called by custom createCommunicationEvent SECA

Posted by Jacques Le Roux <ja...@les7arts.com>.
FYI,

This morning I tested using "session.debug(true);"
Nothing was wrong. I then changed from-address from ofbiztest@yahoo.comm to ofbiztest@les7arts.com and it worked.

Jacques


----- Original Message ----- 
From: "Jacques Le Roux" <ja...@les7arts.com>
To: <of...@incubator.apache.org>
Sent: Tuesday, December 12, 2006 12:02 AM
Subject: Help on sendMail called by custom createCommunicationEvent SECA


> Hi OFBizians,
>
> I have created a custom createCommunicationEvent SECA on the model of
> original createCommunicationEvent
>
> <eca service="createCommunicationEvent" event="commit">
>     <condition field-name="partyIdTo" operator="is-not-empty"/>
>     <condition field-name="subject" operator="contains" value="Problem
> packing order"/>
>     <condition field-name="contactMechTypeId" operator="equals"
> value="EMAIL_ADDRESS"/>
>     <action service="sendCommEventAsEmail" mode="sync"/>
> </eca>
>
> It seems to work (no error msgs, no exceptions) but no msg is actually sent
> (other std msgs are working well)
>
> I have added these lines in EmailServices.sendMail()
>
> String msg = "Send email message to [" + sendTo + "] from [" + sendFrom + "]
> cc [" + sendCc + "] bcc [" + sendBcc + "] subject [" + subject + "]";
> Debug.logInfo(msg, module);
> Debug.logInfo("Email message have been be sent to [" + sendTo + "] had
> context: " + context, module);
>
> just after :
>
> trans.sendMessage(mail, mail.getAllRecipients());
>
> And I get following in the log.
>
> 2006-12-11 23:28:51,703 [     ServiceEcaRule.java:134 :INFO ] Running
> Service ECA Service: sendCommEventAsEmail, triggered by rule on Service:
> createCommunicationEvent
> 2006-12-11 23:28:51,796 [     RequestHandler.java:395 :INFO ]
> [RequestHandler.doRequest]: Response is a view.
> 2006-12-11 23:28:51,796 [     RequestHandler.java:547 :INFO ]
> servletName=control, view=PackOrder
> 2006-12-11 23:28:51,796 [     UtilJ2eeCompat.java:77  :INFO ] serverInfo:
> Apache Tomcat/5.5.9
> 2006-12-11 23:28:51,796 [     UtilJ2eeCompat.java:86  :INFO ] Apache Tomcat
> detected, using response.getWriter to write text out instead of
> response.getOutputStream
> 2006-12-11 23:28:52,078 [         JobInvoker.java:221 :INFO ] Invoker:
> default-invoker-Thread-9 received job -- 1165876131718 from poller -
> org.ofbiz.service.job.JobPoller@d22462
> 2006-12-11 23:28:52,156 [      EmailServices.java:149 :INFO ] Attempting to
> sent email to: orgcs@les7arts.com
> 2006-12-11 23:28:52,937 [      EmailServices.java:259 :INFO ] Send email
> message to [orgcs@les7arts.com] from [ofbiztest@yahoo.com] cc [null] bcc
> [null] subject [Problem packing order  #ORG13266 [To: orgcs
> @les7arts.com, Cc: null, Bcc: null]]
> 2006-12-11 23:28:52,937 [      EmailServices.java:260 :INFO ] Email message
> have been be sent to [orgcs@les7arts.com] had context: {locale=en_FR,
> partyId=externaluser, sendTo=orgcs@les7arts.com, commun
> icationEventId=15451,
> userLogin=[GenericEntity:UserLogin][createdStamp,2006-10-26
> 12:55:38.0(java.sql.Timestamp)][createdTxStamp,2006-10-26
> 12:55:38.0(java.sql.Timestamp)][currentPassword
>
,47ca69ebb4bdc9ae0adec130880165d2cc05db1a(java.lang.String)][disabledDateTime,null()][enabled,Y(java.lang.String)][hasLoggedOut,N(ja
va.lang.String)][isSystem,null()][lastCurrencyUom,null()][lastLocale,en(java
> .lang.String)][lastUpdatedStamp,2006-12-10
> 18:28:15.0(java.sql.Timestamp)][lastUpdatedTxStamp,2006-12-10
> 18:28:15.0(java.sql.Timestamp)][partyId,admin(java.lang.String)][passwordHint,mdp
> std(java.lang.String)
> ][successiveFailedLogins,0(java.lang.Long)][userLoginId,admin(java.lang.String)],
> subject=Problem packing order  #ORG13266, sendFrom=ofbiztest@yahoo.com,
> contentType=null, body=test}
> 2006-12-11 23:28:52,937 [     ServiceEcaRule.java:134 :INFO ] Running
> Service ECA Service: storeEmailAsCommunication, triggered by rule on
> Service: sendMail
> 2006-12-11 23:28:52,953 [     ServiceEcaRule.java:134 :INFO ] Running
> Service ECA Service: setCommEventComplete, triggered by rule on Service:
> sendCommEventAsEmail
> 2006-12-11 23:28:53,031 [     ServiceEcaRule.java:118 :INFO ] Got false for
> condition: [null][][statusId][equals][null][COM_IN_PROGRESS][true][String][]
> 2006-12-11 23:28:53,031 [     ServiceEcaRule.java:118 :INFO ] Got false for
> condition: [null][][statusId][equals][null][COM_IN_PROGRESS][true][String][]
>
> So the message seems well sent but nothing happen. Due to 2 last lines I
> suspect to have done something  wrong in the ECA/SECA chain but I can't see
> what. Also despite my desesperate efforts I can't get contentType set to
> "text/html". This should be default, I also tried to force it, nope.
>
> Somebody an idea ?
>
> Thanks
>
> Jacques