You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

format the message text such as BOLD or change of colour using sendmail peoplecode

7 replies [Last post]
Guest's picture
Guest

Hello,
I have created a custom page to send emails usind sendmail() function. How to format the message text such as BOLD, underline, change color of text or insert image.
Any help will be appreciated.
Thanks

Guest's picture
Guest (not verified)
Re: format the message text such as BOLD or change of colour ...

Hi,
I would prefer you to use delivered app package PT_WF_NOTIFICATION instead of send mail.

For sending emails, create an notification template and in that template use html tags to format your message content.

Regards,

Rahul Khandelwal

Lepa's picture
User offline. Last seen 2 years 6 weeks ago. Offline
Joined: 06/23/2008
Posts: 591
Re: format the message text such as BOLD or change of colour ...

Yes, i agree with Rahul, I've used the notification class before to send HTML emails and it works great.

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog

Guest's picture
Guest (not verified)
Re: format the message text such as BOLD or change of colour ...

Hi,

Can u pls give the code to get letters in bold.am using PT_WF_NOTIFICATION only bt unable to get in bold.

Thanks in advance.

Cheers,
Lucky

rahulkhandelw's picture
User offline. Last seen 9 years 28 weeks ago. Offline
Joined: 10/16/2009
Posts: 34
Re: format the message text such as BOLD or change of colour ...

There is no code as such.. u need to use html tags in ur email template.

Guest's picture
Guest (not verified)
Re: format the message text such as BOLD or change of colour ...

I have used html tags but they are displaying with tags in mail.

Guest's picture
Guest (not verified)
Re: format the message text such as BOLD or change of colour ...

Below is the code.I have created a notification template and then used html tags but still unable to get the text in bold.The html tags are visible.Any idea how to avoid display of html tags?

Local PT_WF_NOTIFICATION:NotificationTemplate &ETemplate;

&Msg1 = MsgGetExplainText(30000, 5, "some text");
&Msg2 = "Descr: " | &Err_Msg | "";
&Msg = &Msg1 | &Msg2;

&ETemplate = create PT_WF_NOTIFICATION:NotificationTemplate("", "", "Example", "G");
&aryValues = CreateArrayRept("", 0);
&aryValues.Push(&Msg);
&xmlVars = &ETemplate.SetupGenericVars(&aryValues);
&Temp = &ETemplate.GetAndExpandTemplate(%Language, &xmlVars);

&mynotification.Message = &ETemplate.Text;
&mynotification.ContentType = "text/html; charset=UTF-8";
&mynotification.Send();

Thanks,

Vara Prasad's picture
Vara Prasad (not verified)
Re: format the message text such as BOLD or change of colour ...

You can make use of PeopleSoft Delivered Application Class:
PT_MCF_MAIL

Example Code:
Creating HTML EmailThe following example creates an HTML email.

import PT_MCF_MAIL:*;

/*-- Create an email object by setting individual parameters
---*/

Local PT_MCF_MAIL:MCFOutboundEmail &email =
create PT_MCF_MAIL:MCFOutboundEmail();

&email.From = &FromAddress;
&email.Recipients = &ToList;
&email.Subject = &Subject;

&email.Text =
"

Hi there!

We are ready.

";

&email.ContentType = "text/html";

Local integer &res = &email.Send();