How can I display email body in bold letters
Hello,
3 answers
plainBody.setText(getPlainContent(), UTF_8);
MimeBodyPart htmlBody= new MimeBodyPart();
htmlBody.setText(getHtmlContent(), UTF_8);
htmlBody.setHeader("Content-type", "text/html; charset=" + UTF_8); //$NON-NLS-1$ //$NON-NLS-2$
MimeMultipart multipart= new MimeMultipart("alternative"); //$NON-NLS-1$
multipart.addBodyPart(plainBody);
multipart.addBodyPart(htmlBody);
mailer.sendMultipartMail(mailservice .getDefaultSender(), getEmailAddress(), "My email subject", multipart, null);
MimeBodyPart plainBody = new MimeBodyPart();
plainBody.setText("test", "UTF_8");
MimeBodyPart htmlBody= new MimeBodyPart();
htmlBody.setText("<b>test<\b>", "UTF_8");
htmlBody.setHeader("Content-type", "text/html; charset=" + "UTF_8"); //$NON-NLS-1$ //$NON-NLS-2$
MimeMultipart multipart= new MimeMultipart("alternative"); //$NON-NLS-1$
multipart.addBodyPart(plainBody);
multipart.addBodyPart(htmlBody);
//
String emailSubject = "Work item " + workItemID + " filed against " + categoryName + " in project area " + projectAreaName + " needs your attention";
for(ITeamAreaHandle teamAreaHandle : teamAreaHandles)
{
ITeamArea teamArea = (ITeamArea)itemService.fetchItem(teamAreaHandle, IRepositoryItemService.COMPLETE);
IContributorHandle[] memberHandles = teamArea.getMembers();
if(memberHandles.length > 0)
{
for(IContributorHandle memberHandle : memberHandles)
{
IContributor teamMember= (IContributor)itemService.fetchItem(memberHandle, IRepositoryItemService.COMPLETE);
String mailAddress = teamMember.getEmailAddress();
//send mail to user
//mailService.sendMail(mailService.getDefaultSender(), mailAddress, emailSubject, emailBody, "");
//Using Multi-part Service here
//mailService.sendMultipartMail(mailService.getDefaultSender(), mailAddress,"test", mp, null);
mailService.sendMultipartMail(mailService.getDefaultSender(), mailAddress, emailSubject, multipart,"");
}
}
Comments
please give me a suggestions on same
We're still going to need the exception stack trace.
There's not enough information in the statement of
"Unable to save work item.javax.mail.BodyPart".
hi David I am unable o get stack trace data, I am stuck in to send html mail,can you please provide sample example related to it
hi Devid, When I add above mentioned cod then I unable to debug the code ,I am unable to trigger code
Did you remember to add the appropriate imports?
Imports at the top of the java file, and updated 'requiredService' in the plugin.xml?
Thank you Devid for quick response, now code is working fine.