Build a dynamic mail body to be sent from IS Service

Hi everyone,

I try to do an IS Service that will send an e-mail using smtp service.
I have no problem to make a properties files to fill the header, and no problem to build a “dynamic” subject (with variable substitutions).

But I don’t know how to do the body…

Well in Inputs I got my canonical with some variables (string variable, listOfString or ListofDocument(An array)). I would like to take a body template in HTML, and “replace” some defined fields. For example :

 
<p> Please here is your invoice [B]%invoiceNumber%[/b] </p>

or

 
<p> 
 
Here is comments about the invoice :
 
<Table> <td>%myDocumentListHeader1%</td> 
....
</Table>
 
</p>

(Quick Example)

I think that I have to use the MINE package (I d’ont not yet how to use it, never used for the moment …)

So I think I have to map my canonical data in this “buildBodyMail” service, before invoke the smtp service.

To you have any idea or examples to help me ?

Maybe a Java service ?

EDIT : I have found something here (my forum search was not completed) : [URL]wmusers.com

Maybe that will help.

Many thanks,
Regards,
Vincent

Hi people,
I resolved my case.

well here is the procedure:

1/ I created a Document with all my variable into it
2/ In create a templte in template package directory according to documentation DSP and Output Template
3/ I use the service : pub.report:runTemplate to build my HTML page
4/ I build an EnvelopeStream for the smtp service :
a/ pub.mine:createMineData
b/ Transform the string output from (3) into stream object with PSutilities.stream:stringToStream
c/ I do a pub.mine:addBodyPart
d/ I do a pub.mine:getEnvelopeStream
5/ Finally I use the pub.client:smtp to send the mail

It works fine ! :slight_smile:

See you

Vincent