Formatting mails

I need to mail some results which are in tabular format.Is there any possibility of HTML formatting available for smtp service…?

Not for the SMTP service itself, but if you use a template to format your data then call the SMTP service you will achieve the results you are looking for. Basically you need to format your email body before calling the SMTP service.

Take a look at the pub.report services

Arun,

Use this built-in service pub.report:runTemplateOnPipe which takes template as input param (design html page with wm output template functionality) and put this designed html template file in ISserver/packages/pub/templates file folder and after running this service gives you $txt output and next step will be the mapping of $txt to SMTP (body param)which accomplishes your task by formatting the body of email .

HTH.

sorry,html designed template file should be placed in the following destination:

ISServer/Packages/yourPackage/templates folder…

OK fine…Thanks Thomas & HTH

I’m able to format mails…But if i send that formatted message i’m getting message with HTML tags…For this settings to be done in the Mail Client side or in the WM side…? Bcas in the case of ASP or JSP we’ll be setting this in the serverside components…

Arun,

take a look at:

[url=“wmusers.com”]wmusers.com

I did a search for “HTML EMAIL”

-Thomas

You can use these steps to make the pub.client:smtp service send HTML messages. First, in your service, create a body variable, and set it to contain the HTML that you want to be sent, concat’ing and looping as needed to append table rows and such. Second, build a smtp wrapper service called sendHTML that has to, from, [cc,] subject, & body inputs. The first line of this new two-line service will be a stringToBytes call. Map this service’s in param, body (it will ultimately be your HTML), to the stringToBytes’ string service-in param, and drop body. Third, map the stringToBytes’ byte output param to the smtp service’s attachments/content service-in param, while setting attachments/contenttype to “text/html”.

Hi Arun,
This is Venkat new to webMethods. I think you might have got a way for problem. Well I am at the same page where you were. I can use a template but the final email body is showing with html tags which is supposed to be formatted. So could you please walkthrough me further?

Thanks!
Venkat

Venkat,

What type of formatting are you looking for?
you can set content-type=text/plain for non html format.

HTH,
RMG

Hi there!
thanks for your quick response.

in fact I am trying to use email service to send emails which is supposed to give an output in HTML format so that I can format the email text as per the requirement.

And I am using the components like:

  • template as input.
  • runTemplateOnPipe
  • sendEmail service

Appreciate your help

thanks!
Venkat

Your steps looks good.What is the actual problem you running into?
If html then did you set content-type=text/html in smtp service?

HTH,
RMG

hi,
By the way I am new to this, so could plz tell me where exactly can I set this property? To my knowledge do I need to change the charset property of the smtp service or any where else?

Thanks!
venkat

Venkat,

If you have successfully obtained a $txt output by following what RMG suggested (ie your $txt contains the html that you want to send as email), map this $txt to the attachments/content and then set the attachments/contenttype=text/html. Set rest of the parameters (to, cc, subject, mailhost, mailhostport), except for body and execute your service. You should shortly see an html email :slight_smile:

HTH, Rohit

Hi,
Finally I could able to format the email as an html output. All I did was use the attachment attribute of the email service and set it’s content type to text/html.

Thanks guys!
Venkat

Absolutely… that’s the part you were missing. You don’t have to set the ‘body’ of the smtp service, instead you set the ‘content’ with the HTML string and set the contenttype to text/html.

Glad you got it working :slight_smile: