java mail send using setText()
0 Answer(s)      2 years and 5 months ago
Posted in : JavaMail

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

final String userName = "";
        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("", "");
        properties.put("mail.smtp.port", 587);
        Session session = Session.getInstance(properties,
                new javax.mail.Authenticator()
                    protected PasswordAuthentication getPasswordAuthentication()
                        return new PasswordAuthentication(userName, password);
        MimeMessage message = new MimeMessage(session);
        message.setFrom(new InternetAddress(""));
        message.setRecipient(Message.RecipientType.TO, new InternetAddress(""));

        message.setSubject("mail testing");
        message.setText("<html><head><title>java<title></head><body>Java / - Java Development and Tools</body></html>");

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: