어느 가을날의 전환점
JAVA|자바로 메일 보내기(Apache Commons Email) 본문
Apache Commons Email
* website: http://commons.apache.org/email/
* wiki: http://wiki.apache.org/commons/Email
* api: http://commons.apache.org/email/api-release/index.html
* website: http://commons.apache.org/email/
* wiki: http://wiki.apache.org/commons/Email
* api: http://commons.apache.org/email/api-release/index.html
Commons Email aims to provide a API for sending email. It is built on top of the Java Mail API, which it aims to simplify.
Some of the mail classes that are provided are as follows:
* SimpleEmail - This class is used to send basic text based emails.
* MultiPartEmail - This class is used to send multipart messages. This allows a text message with attachments either inline or attached.
* HtmlEmail - This class is used to send HTML formatted emails. It has all of the capabilities as MultiPartEmail allowing attachments to be easily added. It also supports embedded images.
* EmailAttachment - This is a simple container class to allow for easy handling of attachments. It is for use with instances of MultiPartEmail and HtmlEmail.
A simple text email
Email email = new SimpleEmail(); email.setHostName("smtp.gmail.com"); email.setSmtpPort(587); email.setAuthenticator(new DefaultAuthenticator("username", "password")); email.setTLS(true); email.setFrom("user@gmail.com"); email.setSubject("TestMail"); email.setMsg("This is a test mail ... :-)"); email.addTo("foo@bar.com");email.send();
#참조
1) http://commons.apache.org/email/userguide.html
2) http://javacan.tistory.com/entry/117
3) javax.mail Library 사용 예제: http://www.okjsp.pe.kr/seq/186937
2) http://javacan.tistory.com/entry/117
3) javax.mail Library 사용 예제: http://www.okjsp.pe.kr/seq/186937
'Development' 카테고리의 다른 글
DOS|텍스트(text, .txt) 파일 병합 방법 (0) | 2012.05.24 |
---|---|
TOMCAT|톰켓 web.xml의 Servlet 로드 옵션 <load-on-startup> (0) | 2012.03.28 |
JAVASCRIPT|팝업 창에서 부모 창의 함수 호출 방법(opener) (0) | 2012.03.14 |
JAVA|자바 소스 코드 분석 툴(잠재적 위험도 분석 등) (0) | 2012.03.07 |
EDITOR|마크다운(Markdown) (0) | 2012.02.15 |
Comments