Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JavaMail java mail send using setText()

Have Programming Question? Ask it here!
 
 
 


Thadeuse
java mail send using setText()
0 Answer(s)      a year and 2 months ago
Posted in : JavaMail


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

final String userName = "xxxxxx@gmail.com";
        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("xxxxxx@gmail.com"));
        message.setRecipient(Message.RecipientType.TO, new InternetAddress("xx@gmail.com"));

        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


Advertisement
View Answers

Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com