Q&A

Q1:What are the main differences among SMTP, POP, and IMAP?
A1: SMTP is a protocol used to send outgoing messages, whereas POP and IMAP are used to retrieve and read incoming messages.
Q2:What are the steps involved in sending an e-mail message through the JavaMail API?
A2: The main steps involved in sending an e-mail message are as follows:
1.
Create a Session object, usually by looking it up in JNDI services.
2.
Create a MimeMessage from the session, as a container to your contents.
3.
Set the to, subject, and content using the addRecipient(), setSubject(), and setContent() methods respectively.
4.
Send the message using Transport.send().

Get Sams Teach Yourself EJB in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.