cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to set attachment when we will send email with invoice attachment

Former Member
0 Likes
1,728

I am currently using the 5.7 version of hybris. I have a requirement of attaching a pdf invoice to the email which is sent out after Order Confirm. How to proceed in this scenario?

A quick response to this would be highly appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Check this

Former Member
0 Likes

I know the approach that you shared but need more clarification. I found one class GenerateEmailAction.java(OOTB), So We can attach the pdf invoice inside this class using: emailMessageModel.setAttachments(emailAttachmentModelList); share your point of view.

Former Member
0 Likes

GenerateEmailAction.java is an action class. It will be called for all the businessProcess related to emails. So, I suggest not to modify this class.

Instead, modify your business process such that, inject an action between generateEmail and sendEmail. Your business process should look like this.

Action 1: generateEmail Action 2: attachDocument Action 3: sendEmail Action 4: removeSentEmail

Create a new action class (MyAttachDocument extends AbstractSimpleDecisionAction). In this class, implement your logic in executeAction method.

Declare this bean in your spring.xml as attachDocument.

Former Member
0 Likes

Thanks Nithish. I have created one class: SendGenerateInvoiceEmailAction.java in which I have override the same method(executeAction) of GenerateEmailAction.java. I have created the class as: public class SendGenerateInvoiceEmailAction extends GenerateEmailAction

I have extended to GenerateEmailAction and now where and how We can declare the bean So that other business process will not get affected.

Former Member
0 Likes

Hi,

The approach which I suggested is a bit different. Anyways, I think following will work in your approach (If you are using business process).

Update your businessprocess.xml like this.

action id='sendGenerateInvoiceEmail' bean='sendGenerateInvoiceEmail'>

And add the following in your core-spring.xml,

     <bean id='sendGenerateInvoiceEmail' parent='abstractGenerateEmailAction' class='my.package.SendGenerateInvoiceEmailAction'>
     <property name='frontendTemplateName' value='ForgottenPasswordEmailTemplate'/>
 </bean>

I hope this works for you.

Former Member
0 Likes

Hi Nithish, Can you tell me which catalog version I should use? In my case I called createEmalAttachment(with expected parameters) method but attachment is not coming in email. It works without attachment. Can you suggest anything else I have to do? Attachment is the my code snippet.link text

Answers (1)

Answers (1)

Former Member
0 Likes

Hello Shaw, Can you tell me how to implement the process of sending mail ?i mean that how to write the code. Thank you very much!

Former Member