سؤال

I'm replacing a class that used to send email over SMTP, now it will do it over another API.

The interface I'm coding to sends in an Apache Commons Email class with the email prepared.

I can't figure out how to either:

  1. Override the functionality of Apache Commons email to use my own transport mechanism instead of SMTP
  2. Or extract the HTML or Text based email from the org.apache.commons.mail.Email base class
هل كانت مفيدة؟

المحلول

Does getMimeMessage() do what you want?

http://commons.apache.org/email/apidocs/org/apache/commons/mail/Email.html#getMimeMessage()

From that you can use getters in the API

http://docs.oracle.com/javaee/1.4/api/javax/mail/internet/MimeMessage.html

to get the message content, headers etc.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top