java mail send using setText()

java mail send using setText()

Hai , Am newly mail send portion in java , Here i write my code ,

final String userName = "[email protected]";
        final String password = "xxx xx xxx";
        Properties properties = new Properties();
        properties.put("mail.smtp.auth", "true");
        properties.put("mail.smtp.starttls.enable", "true");
        properties.put("mail.smtp.host", "smtp.gmail.com");
        properties.put("mail.smtp.port", 587);
        Session session = Session.getInstance(properties,
                new javax.mail.Authenticator()
                {
                    @Override
                    protected PasswordAuthentication getPasswordAuthentication()
                    {
                        return new PasswordAuthentication(userName, password);
                    }
                });
        MimeMessage message = new MimeMessage(session);
        message.setFrom(new InternetAddress("[email protected]"));
        message.setRecipient(Message.RecipientType.TO, new InternetAddress("[email protected]"));

        message.setSubject("mail testing");
        message.setText("<html><head><title>java blog.fr<title></head><body>Java Blog.fr / Java.lu - Java Development and Tools</body></html>");
        Transport.send(message);

Here am using set Text() method to send mail content in html format. if i use set Text() method mail content is display same structure what i wrote the code in java file . but if i use set Content() method, mail content is display html format is right. I want to use set Text() method to send mail in html format . any one help

View Answers









Related Tutorials/Questions & Answers:

Ads