Get Content of email.

Get Content of email.

  

Hi everyone.


I want to know if there is a way to generate (render) an email without sending it.

I hope you can help me.

Hi Joseph


What do you mean? You want to save a Binary? You want to get the HTML of the email?

Tell us your use case



Hi Joseph,

You can send the email to a Fake email account setting the "Log Content" property of the Send Email widget and than get the content of the email in the EMail_Content entity of System.

Don't know other way to do that.

Cheers,
Eduardo Jauch

EDIT:
You will need to use the Sent_Mail entity to identify the right content, I think.

Eduardo Jauch wrote:

Hi Joseph,

You can send the email to a Fake email account setting the "Log Content" property of the Send Email widget and than get the content of the email in the EMail_Content entity of System.

Don't know other way to do that.

Cheers,
Eduardo Jauch

EDIT:
You will need to use the Sent_Mail entity to identify the right content, I think.

Thank you Eduardo.

Look at the binary data.

How can I decode Base64 into HTML.

I have problems because not all the data is encoded.


Hi Joseph,

If you just want the html of the email, one solution is to move all the elements in the Email screen into a Web Block and insert that Web Block into the Email.

Then, you can use the RenderWebBlock action (in the HtmlRenderer Module) to get the html of the Web Block.

Cheers,

José

Joseph,

There are functioons (I think in an extension available in the system), to convert from base64 to text.

But I am being stupid and José pointed it :P lol
You can do as he told you.

But the email content is in fact just a "web screen".
You can "duplicate" your email in a normal screen and get the result content. 

How to get the result will depend on what you want to do with it, I would say.

Cheers,
Eduardo Jauch

I also think Jose´s solution is good

José in my personal environment it generate the HTML, but in enterprise environment it does not.


Personal

Enterprise Environment

Hi Joseph,

I don't see why it should be different...

Does it give you any errors in Service Center?

Cheers,

José

Any error in Service Center.

personal environment .NET

Enterprise environment J2EE

That is the only difference.



Solution

Hi Joseph,

Digging a bit more it seems that the RenderWebBlock is not bullet proof: https://www.outsystems.com/forums/discussion/14097/render-webblock-html/

So, could you try another thing:

  • Place your block inside a screen that has the same theme as your emails. 
  • Then, you use GetRequest_Submit (from HttpRequestHandler) to get the html (in the TextContent output)

Let me know if it works.

Cheers,

José

Solution

Your solution worked.

Thanks for your help. 

By the way, thanks Eduardo.