on ‎2011 Oct 19 11:27 AM
Hi,
I am trying to Modify Font style/size of message text in mail script.
Is there any way to achieve this?
Thanks,
Saloni
Request clarification before answering.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.