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

Can we give a link in email (vm template) which in turn opens email in the browser on click of it

0 Kudos
611

Hi Experts,

I need to give a link in my email template (Ex: View in browser). On click of that link, same email must be opened in a web browser.

Accepted Solutions (0)

Answers (1)

Answers (1)

bhavirisetty
Active Participant
0 Kudos

Hi ,

If you use any third-party mail services they may provide such functionality. Ex: Mailchimp

If you are not using any as such services, You can host the HTML in your external server as .html files and refer the URL for the email every time.

Thanks

arvind-kumar_avinash
Active Contributor
0 Kudos

+1...I support this approach

0 Kudos

Hi Phani,

Thanks for the response. We are using hybris OOB provided email service. Could you please elaborate on how to do "host the HTML in your external server as .html files and refer the URL for the email every time."

Thanks

bhavirisetty
Active Participant
0 Kudos

Hi ,

It's quite simple, Hybris internally prepares HTML and creates an EmailMessageModel internally to send the email.

So EmailMessageModel contains an attribute called bodyMedia(MediaModel) which holds HTML version of the email.

bodyMedia contains code , now while sending email, keep that link in the mail body, a view in the browser which contains href link as https:host/view-mail/media-code

When the user tries to open the link, your custom controller must fetch MediaModel (use DefaultMediaService) and return the html from getURL.

You can see all generated email HTML in the following folder,

hybris\data\media\sys_master\email-body\

Note : In your email-process xml you need disable the remove email action for those mails which you want to provide view in browser feature. If you don't disable you can't fetch the data.

Please let me know if you have questions, accept it as answer if it helps ur requirement.

Thanks