cancel
Showing results for 
Search instead for 
Did you mean: 

How to change Font style and size of message text in mail script

Former Member
0 Kudos

Hi,

I am trying to Modify Font style/size of message text in mail script.

Is there any way to achieve this?

Thanks,

Saloni

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sonali ,

This can be done using Mail Template Macros in the mail template script .

Like - FORMAT("b", "Posted By:") -- Display bold text

Regards

Sudipta

Former Member
0 Kudos

Hi Sudipta,

Below macro is not working in script definition for mail sending.

Is there any other way to achieve this..

Thanks,

Saloni

Former Member
0 Kudos

Hi,

You can try this and let us know if it works:

MimeMultipart content = new MimeMultipart();

MimeBodyPart html = new MimeBodyPart();

Mention the preferred font size, type, color etc. below:

html.setContent(htmlBody, "text/html");

html.setHeader("MIME-Version" , "1.0" );

html.setHeader("Content-Type" , html.getContentType() );

content.addBodyPart(html);

message.setContent( content ); message.setHeader("MIME-Version" , "1.0" ); message.setHeader("Content-Type" , content.getContentType() ); message.setHeader("X-Mailer", "My own custom mailer");

Transport.send(msg);

Regards,

Vikram Shukla

Former Member
0 Kudos

Hi Vikram,

I used code suggested by you and tried to set font in below ways:

content.setFont("Times New Roman");

or

Font f1 = new Font("Sans Serif",Font.BOLD,15);

content.setFont(f1);

or

ContentType cType2 = new ContentType();

cType2.setParameter("color", "red");

But it didnt work.

Please help with the syntax to set font size, type, color etc.

Thanks,

Saloni