`

use simpleMail to send email

    博客分类:
  • java
阅读更多

 通过java发送邮件的最简单方式是使用SimpleMail,它对JavaMail进行了封装,操作非常简单。示例如下:

 

SimpleEmail email=new SimpleEmail();

	email.setCharset("UTF-8");

	        email.setHostName(mailModule.getMailServer());

	        if (mailModule.getUsername()!=null && mailModule.getUsername().length()>0) {

	        	email.setAuthentication(mailModule.getUsername(), mailModule.getPassword());

	        }

	        email.setFrom(from);

	        email.addTo(to);

	        email.setSubject(subject);

	        email.setMsg(message);

	        

	        email.send();

 

 

分享到:
评论

相关推荐

    Sending Email using MAPI - A COM DLL(sending email demo and soucecode)

    The demo project demonstrates the way you can use the component to send an email. In order to execute the demo project, the following settings are required: Step 1: You must have some valid Output ...

    计算机网络第六版答案

    First, the content provider has more control over the user experience, since it has to use few intermediary ISPs. Second, it can save money by sending less traffic into provider networks. Third, if ...

    Java邮件开发Fundamentals of the JavaMail API

    You use the package to create Mail User Agent (MUA) type programs, similar to Eudora, pine, and Microsoft Outlook. The API's main purpose is not for transporting, delivering, and forwarding ...

    Sakemail

    Added examples.0.9.2.1b- Fixed a bug when send a mail and the first line disappear (thanks to Arun)- Now, you could do MySMTP.MsgTo := ‘a@doma.com; b@domb.com;c@domc.com‘; the spaces before/after ...

    Dart PowerTCP Mail for ActiveX 2.9.4.1

    The PowerTCP Mail Tool contains email components which allow you to create, send, retrieve, preview, and edit mail messages while verifying E-mail addresses using simple properties and methods....

    VB编程资源大全(英文源码 网络)

    chatserv.zip Server side of an internet chat program<END><br>10 , hlink.zip Is a control that you can use to link your program to a web site.<END><br>11 , Popmail.zip Checks your email!...

    WinZip Pro 18.5 Build 11111 (x86-x64)+SerialKey

    • Use Send To and send new and existing Zip files as e-mail attachments • New! Zip and FTP Upload Selected Files from an existing Zip file • FTP Upload new and existing Zip files • Zip and Burn ...

    ICS delphixe10源码版

    send cash (Euro currency or US Dollars) in an envelop to my street address or buy a gift certificate at Amazon in the UK. I will then use it to buy books. Here is the direct URL at Amazon UK (nearest ...

    VB编程资源大全(英文源码 其它)

    The method of inserting into MSWord may be more useful to most of you..<END><br>48,stopw.zip Example of a stopwatch which does not use a timer control for the calculations, just a simple ...

    VB编程资源大全(英文源码 ASP)

    <END><br>12,ASP_CDOMail.zip Using Microsoft Technologies, a simple example of how to send email using ASP, CDO, and IIS. Full Source. Information on CDO is well documented on the Internet. <END>...

    Clever Internet Suite (SRC) v9.1.0.0

    The SMTP, POP3 and IMAP clients allow you to send and retrieve email messages over the Internet. All server components represent the fully functional multithreaded servers with the ability to ...

    php.ini-development

    You may be able to send headers and cookies after you've already sent output ; through print or echo. You also may see performance benefits if your server is ; emitting less packets due to buffered ...

    王小平版遗传算法的光盘源代码

    To participate in our on-line Internet e-mail forum send your subscription request to: genetic-programming-request@cs.stanford.edu Basically, the code does the same things that Koza & Rice s simple...

    rfc3550中文版

    6 5 3 EMAIL:电子邮件地址的SDES数据项(EMAIL: Electronic Mail Address SDES Item) 6 5 4 PHONE:电话号码的SDES数据项(PHONE: Phone Number SDES Item) 6 5 5 LOC:地理用户地址的SDES数据项(LOC: ...

    rfc3550 RTP协议中文版本

    6 5 3 EMAIL:电子邮件地址的SDES数据项(EMAIL: Electronic Mail Address SDES Item) 6 5 4 PHONE:电话号码的SDES数据项(PHONE: Phone Number SDES Item) 6 5 5 LOC:地理用户地址的SDES数据项(LOC: ...

    rfc3550 rtp协议 中文版本

    6 5 3 EMAIL:电子邮件地址的SDES数据项(EMAIL: Electronic Mail Address SDES Item) 6 5 4 PHONE:电话号码的SDES数据项(PHONE: Phone Number SDES Item) 6 5 5 LOC:地理用户地址的SDES数据项(LOC: ...

    RFC3550_RTP:实时应用程序传输协议

    6 5 3 EMAIL:电子邮件地址的SDES数据项(EMAIL: Electronic Mail Address SDES Item) 6 5 4 PHONE:电话号码的SDES数据项(PHONE: Phone Number SDES Item) 6 5 5 LOC:地理用户地址的SDES数据项(LOC: ...

    RFC3550中文版 (RTP/RTCP)

    6 5 3 EMAIL:电子邮件地址的SDES 数据项(EMAIL: Electronic Mail Address SDES Item) 6 5 4 PHONE:电话号码的SDES 数据项(PHONE: Phone Number SDES Item) 6 5 5 LOC:地理用户地址的SDES 数据项...

    ZendFramework中文文档

    1. Introduction to Zend Framework 1.1. 概述 1.2. 安装 2. Zend_Acl 2.1. 简介 2.1.1. 关于资源(Resource) 2.1.2. 关于角色(Role) 2.1.3. 创建访问控制列表(ACL) 2.1.4. 注册角色(Role) 2.1.5. 定义访问...

Global site tag (gtag.js) - Google Analytics