Hello there,
JavaMail programming is so fun! I first start off mixing the JavaMail code inside a
servlet and then refactored it to two separate classes.
Mailer is the independent class which uses JNDI to look up config parameters, sends e-mails, and then closes the connection with the protocol.
MailController is just a simple
Java servlet where a Mailer object is instantiated and a
String is passed inside the Mailer.sendMsg() method.
Have some OO design issues...
If you can notice, I manually place the body of the e-mail (as a String) from inside the client (in this case, a Java Servlet). Also, I manually have to switch the content type inside the doPost().
Question(s):
(1) How can the Mailer class be set up, so it can send both HTML and plain text messages?
(2) How can the Mailer class be structured to send e-mail to multiple recipients or one user?
(3) Would both of these features / actions require writing two overloaded methods for sendMsg()?
Would appreciate it if someone could help me...
Happy programming,
Michael