November 2006
Intermediate to advanced
224 pages
3h 29m
English
Properties props = new Properties( ); props.put("mail.smtp.host", "mail.yourhost.com"); Session session = Session.getDefaultInstance(props, null); Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress("tim@timothyfisher.com")); InternetAddress toAddress = new InternetAddress("kerry@timothyfisher.com"); msg.addRecipient(Message.RecipientType.TO, toAddress); msg.setSubject("Test Message"); msg.setText("This is the body of my message."); Transport.send(msg); |
In this phrase, we send a plaintext email message using an SMTP server. There are six basic steps that you should always follow when you want to send email using the JavaMail API. These steps are identified here:
1. | Create a java.util.Properties object, which ... |
Read now
Unlock full access