`

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 ...

    django中send_mail功能实现详解

    在Django框架中,`send_mail` 是一个用于发送电子邮件的内置函数,它极大地简化了Python的SMTP(Simple Mail Transfer Protocol)邮件发送过程。本文将深入讲解如何使用 `send_mail` 功能,以及相关的配置和注意事项...

    Perl的Email 发送程序与插件

    在提供的压缩包文件`Perl Email Send`中,可能包含了示例的Perl脚本或配置文件,演示如何使用`Mail::Sender`或其他相关模块来发送邮件。通过学习这些文件,你可以更好地理解如何在实际项目中实现Perl的邮件发送功能...

    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 ...

    计算机网络第六版答案

    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 ...

    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 ...

    smtp_smtp_email_python_possiblevhz_

    Python中的SMTP(Simple Mail Transfer Protocol)模块是用于发送电子邮件的标准库,主要涉及到`smtplib`和`email`两个库。在"smtp_smtp_email_python_possiblevhz_"这个主题中,我们将深入探讨如何使用Python通过...

    Email的收发,用Vb.Net编写的.zip

    在VB.NET中实现电子邮件的发送和接收是一项常见的编程任务,主要涉及到SMTP(Simple Mail Transfer Protocol)和POP3(Post Office Protocol)协议。本教程将详细解释如何使用VB.NET进行电子邮件的处理。 首先,...

    yztphp.rar

    use YztPHP\Mail\Email; $email = new Email(); $email->setFrom('your-email@example.com', '发件人姓名'); $email->addTo('recipient@example.com', '收件人姓名'); $email->setSubject('邮件主题'); $email->set...

    PHP简单邮件系统

    SMTP(Simple Mail Transfer Protocol)是互联网上用于传输邮件的标准协议。PHPMail通过SMTP连接到邮件服务器,设置发件人、收件人、主题和邮件内容,然后发送邮件。 创建PHP邮件系统的基本步骤如下: 1. **安装...

    asp.net Email发送源码

    SMTP(Simple Mail Transfer Protocol)是互联网上用于发送电子邮件的标准协议。Jmail组件就是基于SMTP协议,为.NET Framework提供了封装好的邮件发送功能。 **Jmail组件介绍:** Jmail是一款由DimiSoft公司开发的...

    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 ...

    PHP用SMTP发送邮件示例

    当我们需要通过网站向用户发送电子邮件时,PHP可以借助SMTP(Simple Mail Transfer Protocol)协议来实现这一功能。SMTP是互联网标准,用于在邮件服务器之间传递邮件。在本示例中,我们将探讨如何使用PHP通过SMTP...

    php通用邮件发送示例

    首先,SMTP(Simple Mail Transfer Protocol)是一种用于在邮件服务器之间传输邮件的标准协议。在PHP中,我们通常使用PHPMailer或者SwiftMailer库来实现SMTP邮件发送,但这里提及的是一个自测试并完善的示例,所以...

    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>...

    SakEmail 一个发邮件的Delphi控件及演示示例

    1. 支持多种邮件协议:SakEmail不仅支持SMTP(Simple Mail Transfer Protocol)发送邮件,还支持POP3(Post Office Protocol version 3)接收邮件,为开发者提供了完整的邮件处理能力。 2. 多附件支持:该控件允许...

Global site tag (gtag.js) - Google Analytics