Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,161,449 members, 7,846,881 topics. Date: Saturday, 01 June 2024 at 05:40 AM

Sending Email With Java In HTML Format (javamail API) - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Sending Email With Java In HTML Format (javamail API) (615 Views)

Can I Claim Expert In Html,javascript,css & Php After 1yrs Of Constant Learning? / Learning To Program With Java by the Fulaman / How Can I Learn OOP With Java? (2) (3) (4)

(1) (Reply)

Sending Email With Java In HTML Format (javamail API) by Anatech(m): 1:56am On May 07, 2015
Sending email with Java

You can insert HTML tags when sending email in text format but that isn’t enough to make the e-mail interpreted as an HTML e-mail in a web mail or an e-mail client program. So, instead of using:

First of all, download the Java Mail jar file (to add to your Classpath)


Message msg = new MimeMessage(session);
msg.setText(message);

we should invoke the setContent(Object obj, String type) method of the MimeMessage object. The setContent() method specifies the mime type of the content explicitly, and for HTML format, the type parameter must be “text/html”:

<a href="http://www.anatech.com.ng/sending-email-with-java/">Read More</a>

(1) (Reply)

C Program Without A Mainfunction / How The Youth Are Helping Orphans In Ghana To Learn ICT / How To Integrate Opencart Store With Ebay?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 5
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.