cancel
Showing results for 
Search instead for 
Did you mean: 

Why UID is using instead of email for the customer While Order confirmation Email Generation Process in B2B Site

former_member664713
Active Participant
0 Kudos

By default, B2B Site using the uid of Customer while generating the order confirmation email. But I want to Use customer email to send the order confirmation.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello , This we can resolve from the code In DefaultCustomerEmailResolutionService this class hybris people are verifying the customer uid as email address in the method validateAndProcessEmailForCustomer . they are considering the customer Uid as Email address . So in the catch block you can check again whether the user has any email address either from his addresses or from currentUser and return it if the uid is not equal to Email addresss. like below.

email = customerModel.getAddresses().iterator().next().getEmail(); if (StringUtils.isBlank(email)) { final B2BCustomerModel b2BCustomerModel = (B2BCustomerModel) userService.getCurrentUser(); email = b2BCustomerModel.getEmail(); } if (StringUtils.isNotBlank(email)) { LOG.info("Found one Email Address for Customer :: " + email); }

Former Member
0 Kudos

Hello,
I think from OOTB the order confirmation email should be sent using user(customer)'s email .
As you can see from "b2bapprovalprocess-spring.xml", the bean:

 <bean id="informOfOrderApproval"
           class="de.hybris.platform.b2b.process.approval.actions.InformOfOrderApproval"
           parent="abstractProceduralB2BOrderApproveAction">
      <property name="fromAddress" value="b2b@hybris.com"/>
      <property name="b2bEmailService" ref="b2bEmailService"/>
 </bean>

In "b2bEmailService(DefaultB2BEmailService)", the method "createOrderApprovalEmail()" is to create this kind of email. And for the email's recipient, it is like this:

 email.addTo(user.getEmail());

However, you can implement your own emailService bean in the "informOfOrderApproval", by extending "DefaultB2BEmailService", and override "createOrderApprovalEmail()" to make sure the email is sent to the customer's email address.
Hopefully this could help you a little bit.

Thanks & Regards,
Hongxian