- 浏览: 1151565 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (411)
- Java Foundation (41)
- AI/机器学习/数据挖掘/模式识别/自然语言处理/信息检索 (2)
- 云计算/NoSQL/数据分析 (11)
- Linux (13)
- Open Source (12)
- J2EE (52)
- Data Structures (4)
- other (10)
- Dev Error (41)
- Ajax/JS/JSP/HTML5 (47)
- Oracle (68)
- FLEX (19)
- Tools (19)
- 设计模式 (4)
- Database (12)
- SQL Server (9)
- 例子程序 (4)
- mysql (2)
- Web Services (4)
- 面试 (8)
- 嵌入式/移动开发 (18)
- 软件工程/UML (15)
- C/C++ (7)
- 架构Architecture/分布式Distributed (1)
最新评论
-
a535114641:
LZ你好, 用了这个方法后子页面里的JS方法就全不能用了呀
页面局部刷新的两种方式:form+iframe 和 ajax -
di1984HIT:
学习了,真不错,做个记号啊
Machine Learning -
赵师傅临死前:
我一台老机器,myeclipse9 + FB3.5 可以正常使 ...
myeclipse 10 安装 flash builder 4.6 -
Wu_Jiang:
触发时间在将来的某个时间 但是第一次触发的时间超出了失效时间, ...
Based on configured schedule, the given trigger will never fire. -
cylove007:
找了好久,顶你
Editable Select 可编辑select
SMTP POP3的区别到底是什么?
http://www.wisegeek.com/what-is-the-difference-between-smtp-and-pop.htm
引用
There are two standards currently used for most e-mail sent today. SMTP stands for simple mail transfer protocol. POP is an acronym Post Office Protocol. Though it may sound confusing, the difference is not hard to understand. POP is a protocol for storage of email. SMTP is a protocol for sending and receiving.
要站在邮件服务器的角度理解邮件协议:
对server来说,smtp就是用来收/发邮件的协议;而pop(3是其版本)是用来存储邮件的协议。
How email works (MTA, MDA, MUA):
http://en.kioskea.net/contents/courrier-electronique/fonctionnement-mta-mua.php3
引用
简而言之:
MTA(Mail Transport Agent) 就是常说的 SMTP Server
MDA(Mail Delivery Agent) 就是常说的 POP server or IMAP server (depending on which protocol is used.)
MUA(Mail User Agent) 就是常说的 email client(邮件客户端),如Mozilla Thunderbird, Microsoft Outlook, Lotus Notes等。
MTA(Mail Transport Agent) 就是常说的 SMTP Server
MDA(Mail Delivery Agent) 就是常说的 POP server or IMAP server (depending on which protocol is used.)
MUA(Mail User Agent) 就是常说的 email client(邮件客户端),如Mozilla Thunderbird, Microsoft Outlook, Lotus Notes等。
SMTP Server reply codes:
http://www.greenend.org.uk/rjk/tech/smtpreplies.html
Email Headers 详解:
http://support.google.com/mail/answer/29436?hl=en
headers 中的 From / Sender / Return-Path 的区别是什么?
http://stackoverflow.com/questions/3835065/smtp-e-mail-headers-return-path-vs-sender-vs-from
邮件反垃圾之 MX SPF DKIM DMARC:
http://m.udpwork.com/item/4690.html
MX (Mail eXchanger):
http://support.google.com/a/bin/answer.py?hl=cn&hlrm=zh-Hant&answer=48090
引用
邮件交换 (MX) 记录将域的电子邮件导向至服务器。一个域可定义多个 MX 记录,每个记录都有不同的优先级,数字越小表示优先级越高。如果邮件通过第一优先级记录无法递送,则采用第二优先级,以此类推。
DKIM (DomainKeys Identified Mail):
http://support.google.com/a/bin/answer.py?hl=cn&hlrm=en&answer=174124
引用
垃圾邮件发件人可以伪造邮件上的“发件人”地址,使垃圾邮件看起来好像来自某个受信任的其他的域、地址。为了防止这种滥用行为,使用 DKIM 技术可以将数字“签名”添加到从发件人所在域发送的邮件的 Email Headers 中。收件人可以通过检查域签名来验证该邮件是否确实来自于发件人所在的域,且中途没有被更改过。
SPF (Sender Policy Framework):
http://blog.csdn.net/blade2001/article/details/8509203
引用
SPF是为了防范垃圾邮件而提出来的一种DNS记录类型,它是一种TXT类型的记录,它用于登记某个域名拥有的用来外发邮件的所有IP地址。当你定义了你的domain name的SPF记录之后,接收邮件方会根据你的SPF记录来确定连接过来的IP地址是否被包含在SPF记录里面,如果在,则认为是一封正确的邮件,否则则认为是一封伪造的邮件。
DMARC (Domain-based Message Authentication, Reporting & Conformance)
http://blog.163.com/pandalove@126/blog/static/9800324520123147328334/ or
http://www.mail163.cn/anti-spam/DMARC-Technical.html
引用
由 Paypal,Google,Microsoft, Yahoo 等公司联手成立的,基于现有的 DKIM 和 SPF 两大主流电子邮件安全协议的反垃圾邮件技术,目前尚未成熟,仍处于草案阶段。
工具:
通过分析 Email Header,找到邮件最初被哪个 SMTP Server 发出来(它的域名及IP地址;在收件服务器对该原始发件SMTP Server做SPF时,会需要用到它的IP地址):
http://whatismyipaddress.com/trace-email
关于 gmail 的 mailed-by & signed-by:
http://blog.wordtothewise.com/2011/06/gmail-shows-authentication-data-to-the-recipient/
Java Mail
Session,Transport,(under Transport)Socket Connection 关系:
A Session only holds configuration information.
A Transport corresponds to a single connection.
https://forums.oracle.com/forums/thread.jspa?threadID=2435565
引用
You can definitely share a JavaMail Session object between threads since the Session contains
only configuration information.
Sharing a JavaMail Transport object between threads is not a good idea. A Transport represents
a connection to the mail server and only one thread can use the connection at a time.
If you open a Transport connection and keep it around for a long time without using it, the server
may close the connection. Servers want you to open connections only when you're using them.
Servers also don't want you to abuse a connection and so may close a connection if they think
you're using it too much (e.g., to send spam). You can't prevent either of these actions, but you
can detect that the connection has been closed and open a new connection when you need it.
http://stackoverflow.com/questions/14238149/whats-the-relation-between-session-and-smtp-connection-in-javamail
only configuration information.
Sharing a JavaMail Transport object between threads is not a good idea. A Transport represents
a connection to the mail server and only one thread can use the connection at a time.
If you open a Transport connection and keep it around for a long time without using it, the server
may close the connection. Servers want you to open connections only when you're using them.
Servers also don't want you to abuse a connection and so may close a connection if they think
you're using it too much (e.g., to send spam). You can't prevent either of these actions, but you
can detect that the connection has been closed and open a new connection when you need it.
Session/Transport 与 Thread safety:
http://stackoverflow.com/questions/12732584/threadsafety-in-javamail
引用
Admittedly the thread safety rules for JavaMail are not well documented, but hopefully they mostly match what you would expect.
Multiple threads can use a Session.
Since a Transport represents a connection to a mail server, and only a single thread can use the connection at a time, a Transport will synchronize access from multiple threads to maintain thread safety, but you'll really only want to use it from a single thread.
Similarly, a Store can be used by multiple threads, but access to the underlying connection will be synchronized and single threaded.
A Message should only be modified by a single thread at a time, but multiple threads should be able to read a message safely (although it's not clear why you would want to do that).
https://forums.oracle.com/forums/thread.jspa?threadID=1587336&tstart=105Multiple threads can use a Session.
Since a Transport represents a connection to a mail server, and only a single thread can use the connection at a time, a Transport will synchronize access from multiple threads to maintain thread safety, but you'll really only want to use it from a single thread.
Similarly, a Store can be used by multiple threads, but access to the underlying connection will be synchronized and single threaded.
A Message should only be modified by a single thread at a time, but multiple threads should be able to read a message safely (although it's not clear why you would want to do that).
引用
First, don't use Session.getDefaultInstance, use Session.getInstance.
A Session encapsulates configuration information. You can safely shared
a Session between threads, assuming they all need the same configuration.
Sharing an SMTP Transport between threads is probably a bad idea.
While the Transport has synchronized methods to protect its own state,
you might not want one thread to wait until another thread is completely
done sending a message. It may depend on whether the main job of each
thread is to send a message, or whether the threads are doing lots of other
work and sending a message is just incidental and infrequent.
A Session encapsulates configuration information. You can safely shared
a Session between threads, assuming they all need the same configuration.
Sharing an SMTP Transport between threads is probably a bad idea.
While the Transport has synchronized methods to protect its own state,
you might not want one thread to wait until another thread is completely
done sending a message. It may depend on whether the main job of each
thread is to send a message, or whether the threads are doing lots of other
work and sending a message is just incidental and infrequent.
JavaMail Official Site:
http://www.oracle.com/technetwork/java/javamail/index.html
JAVAMAIL API FAQ:
http://www.oracle.com/technetwork/java/javamail/faq/index.html
JavaMail API Design Specification:
http://www.oracle.com/technetwork/java/javamail-1-149769.pdf
JavaMail API Javadocs:
http://javamail.kenai.com/nonav/javadocs/
Sending an Email using the JavaMail API:
http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/javamail/javamail.html
Fundamentals of the JavaMail API:
http://www.digilife.be/quickreferences/pt/fundamentals%20of%20the%20javamail%20api.pdf
JavaMail深入体验开发二: JavaMail的体系结构及发送复杂邮件:
http://blog.csdn.net/t12x3456/article/details/7636701
引用
JavaMail API按其功能划分通常可分为如下三大类:
创建和解析邮件内容的API :Message类是创建和解析邮件的核心API,它的实例对象代表一封电子邮件。
发送邮件的API:Transport类是发送邮件的核心API类,它的实例对象代表实现了某个邮件发送协议的邮件发送对象,例如SMTP协议。
接收邮件的API:Store类是接收邮件的核心API类,它的实例对象代表实现了某个邮件接收协议的邮件接收对象,例如POP3协议。
Session类
Session类用于定义整个应用程序所需的环境信息,以及收集客户端与邮件服务器建立网络连接的会话信息,如邮件服务器的主机名、端口号、采用的邮件发送和接收协议等。Session对象根据这些信息构建用于邮件收发的Transport和Store对象,以及为客户端创建Message对象时提供信息支持。
http://www.coderanch.com/how-to/java/JavaEnterpriseEditionFaq
spring 的 javamail 封装:
http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mail.html
AOP 101: Speeding up Spring’s JavaMailSenderImpl with AOP:
http://springinpractice.com/2008/11/15/aop-101-speeding-up-springs-javamailsenderimpl-with-aop/#
关于smtp发送的 mail.smtp.timeout 和 mail.smtp.connectiontimeout:
https://forums.oracle.com/forums/thread.jspa?messageID=6660679
引用
The java socket api makes a distinction between the timeout for opening a socket connection and the timeout for any read/write operation on that socket after it has been opened.
So mail.smtp.connectiontimeout is the timeout (in milliseconds) for establishing the SMTP connection and mail.smtp.timeout is the timeout (also milliseconds) for sending the mail messages. You can start by setting them both to the same reasonable value depending on how slow your servers tend to be and then tune them for the best user experience.
transport.close()时会用到mail.smtp.timeout。
So mail.smtp.connectiontimeout is the timeout (in milliseconds) for establishing the SMTP connection and mail.smtp.timeout is the timeout (also milliseconds) for sending the mail messages. You can start by setting them both to the same reasonable value depending on how slow your servers tend to be and then tune them for the best user experience.
这两个 timeout 的默认值都是无限大(Default is infinite timeout).
关于JavaMail v1.4.3+ 的 SMTPTransport.isConnected() 与 mail.smtp.noop.strict(noopStrict,默认true)的关系:
https://forums.oracle.com/forums/thread.jspa?threadID=1556610
引用
JavaMail uses the SMTP NOOP command to determine if the connection is still alive and surprisingly some servers don't return the correct response code to that command. We used to be very lax about the expected response code but as more and more servers started returning the expected response code we tightened this up. If you're using an older server that still returns the wrong response code, you might need to set "mail.smtp.noop.strict" to "false".
疑问:
prop配置的mail.from、mail.smtp.from,及MimeMessage本身的setFrom()之from的关系是什么?
为什么配置了mail.from或mail.smtp.from,MimeMessage本身还必须通过调用setFrom()设置from(不设置的话收件人收到的email message在收件箱里看不到from信息的)?
解答:
http://javamail.kenai.com/nonav/javadocs/com/sun/mail/smtp/SMTPMessage.html#setEnvelopeFrom(java.lang.String)
引用
Set the From address to appear in the SMTP envelope. Note that this is different than the From address that appears in the message itself. The envelope From address is typically used when reporting errors. See RFC 821 for details.
If set, overrides the mail.smtp.from property.
http://www.oracle.com/technetwork/java/faq-135477.html#smtpfrom
If set, overrides the mail.smtp.from property.
http://stackoverflow.com/questions/1782659/how-to-set-the-return-path-to-an-email-address-other-than-sender-address-using-j
message本身的from 和 mail.from/mail.smtp.from是完全不一样的;message本身的from是邮件的收件人看到的“邮件是由谁发的”;而mail.from/mail.smtp.from,则是邮件被退回(bounced)等时,被退到的邮箱地址。
另外注意message的replyTo是设置“回复地址”的;message的replyTo如果未设置,默认就使用其from;如果希望回复邮箱和发件邮箱不一样,可以设置该属性。
mail.xxx和mail.protocol.xxx之间,则是在该特定protocol下,后者会将前者重写掉的关系。
另外记得在prop里或者设置"mail.user" and "mail.host",或者设置"mail.from",不可以三个都不设置:
http://www.oracle.com/technetwork/java/faq-135477.html#securityManager
引用
Alternatively, the application can use its own Properties object and be sure to set the "mail.from" property or the "mail.user" and "mail.host" properties (see the InternetAddress.getLocalAddress() method).
connection hangs by SMTP Server:
http://stackoverflow.com/questions/8265933/continuous-email-server-connection-using-java-mail-api
use Spring + JNDI acquire javamail Session:
http://stackoverflow.com/questions/12257304/javamailsender-returning-null-pointer-exception
发表评论
-
Lucene & Solr
2013-05-07 17:30 2431Params of solr query (参见 solrj ... -
Continuous Integration Server:Jenkins & Hudson
2013-04-15 16:15 1478Jenkins: http://jenkins-ci.org/ ... -
Spring Integration
2013-03-26 16:52 3050Spring Integration Reference ... -
高可用与负载均衡:Haproxy(or lVS) + keepalived
2013-01-29 20:35 3198sources: Setting Up A High ... -
Spring Batch: 大数据量批量并行处理框架
2013-01-11 16:19 4850Spring Batch Documentati ... -
AOP: Aspect Oriented Programming
2013-01-06 11:13 2795The AspectJ Programming Gu ... -
Performance & Load test tool : JMeter
2012-12-18 14:28 1295Official: http://jmeter.apa ... -
rabbitmq & spring amqp
2012-12-04 00:09 8720My main AMQP post on blogger ... -
未完 Spring MVC
2012-11-15 22:41 2136Annotations for Http pa ... -
JUnit 单元测试
2012-10-30 12:27 2577测试的分类: http://s ... -
Hibernate
2011-08-02 11:48 1190Hibernate缓存: 一级缓存的生命周期和session的 ... -
Maven Repository Management & Nexus
2011-07-30 11:39 1442Why do I need a Repositor ... -
XStream
2011-07-13 00:18 1388XStream 内置 Converters: http://x ... -
Hibernate注解: 联合主键:@IdClass vs @EmbeddedId
2011-07-12 21:01 15391Hibernate Annotations -> 2.2 ... -
Struts2 Tag 标签
2011-05-04 00:43 1644struts2 OGNL 中的#、%等符号的区别: Apach ... -
Spring
2011-04-07 19:10 2907Spring API & Reference: htt ... -
iBATIS cacheModel 缓存
2011-04-07 14:29 1361http://ibatis.apache.org/docs/d ... -
Template Engine: FreeMarker & Velocity
2011-01-16 22:56 4116FreeMarker http://freemar ... -
Struts2 标签 <s:url>中添加多个<s:param>的奇怪问题 待整理
2011-01-14 13:27 1925问题描述(我的回复): http://went3456.ite ... -
J2EE核心技术
2010-12-31 01:16 2667http://www.berheley.com/jsnl/J2 ...
相关推荐
JavaMail邮件系统的设计与实现是基于Java编程语言的,它利用了JavaMail API来处理电子邮件的发送、接收等任务。JavaMail API是一个开源的、跨平台的库,它提供了与各种邮件服务器通信的能力,支持SMTP(简单邮件传输...
JavaMail邮件管理系统是一款基于Java技术实现的邮件服务应用程序,它利用SMTP(Simple Mail Transfer Protocol)协议来发送邮件,以及IMAP(Internet Message Access Protocol)协议来接收和管理邮件。这两个协议是...
在Java编程领域,JavaMail API是一个非常重要的工具,它允许开发者通过编程方式发送电子邮件。"常规JavaMail 邮件发送实用类"标题所指的,通常是一个自定义的Java类,封装了JavaMail API的基本操作,使得邮件发送变...
JavaMail邮件收发实例_JavaMail_API JavaMail邮件收发实例_JavaMail_API JavaMail邮件收发实例_JavaMail_API JavaMail邮件收发实例_JavaMail_API JavaMail邮件收发实例_JavaMail_API
JavaMail邮件发送工具类是Java开发中用于发送电子邮件的标准库,它提供了丰富的API来处理复杂的邮件功能。在JavaMail中,我们可以通过创建特定的类和对象来实现邮件的发送。以下将详细介绍这些类以及如何使用它们。 ...
JavaMail邮件系统开发是Java开发者在构建应用程序时用于发送和接收电子邮件的重要工具。它是一个开源的API,提供了丰富的功能,让开发者能够轻松地与各种邮件服务器进行交互。在这个主题中,我们将深入探讨JavaMail...
### JavaMail邮件开发详解 #### 一、JavaMail API简介 JavaMail API 是一个用于读取、撰写和发送电子邮件的强大工具包。它主要用于构建邮件用户代理程序(Mail User Agent,简称 MUA),这类程序通常包括像 Eudora...
JavaMail邮件发送实例是Java开发中常见的一个应用场景,主要用于实现程序自动发送电子邮件的功能。这个实例可以帮助开发者理解如何使用JavaMail API来构建邮件服务。在JavaMail API中,我们可以使用MimeMessage类...
### JavaMail邮件开发系统教程知识点总结 #### 一、引言 JavaMail API是由Sun Microsystems为Java开发者提供的一套强大的邮件处理工具集。它支持多种邮件通信协议(如SMTP、IMAP、POP3等),并为Java应用程序提供了...
JavaMail邮件发送Demo是Java开发中用于实现电子邮件发送的一个实例,它依赖于两个关键的库:activation.jar和mail.jar。这两个库提供了JavaMail API,使得Java开发者能够方便地与各种邮件服务器进行交互,完成邮件的...
JavaMail邮件实战开发 在 JavaMail 邮件实战开发中,我们学习了电子邮件技术的基础知识,包括邮件服务器、邮件传输协议和邮件组织结构。 邮件服务器 邮件服务器是提供电子邮件功能的专门服务器,它有三个主要功能...
JavaMail邮件上传发送的成功的小demo是一个实用的程序示例,它展示了如何利用JavaMail API在Java应用程序中实现邮件的上传和发送功能。JavaMail是一个开源的Java库,它提供了丰富的API,使得开发者能够轻松地处理...
JavaMail邮件发送源码是Java开发中用于发送电子邮件的一个库,它提供了丰富的API来处理SMTP、POP3和IMAP等邮件协议。这个简单的javamail实例表明,开发者已经成功地测试了邮件发送功能,确保其在实际应用中可以正常...
在本篇文章中,我们将深入探讨如何利用Spring来实现JavaMail邮件发送,以及在实际应用中需要注意的关键点。 首先,我们需要理解JavaMail API的基础概念。JavaMail是一个用于处理邮件的开放源码API,它允许开发者...
这个“javamail邮件发送接收测试”是开发者在学习过程中创建的一个测试项目,旨在帮助理解和实践 JavaMail 的核心功能。通过这个项目,我们可以深入理解如何使用 JavaMail API 来实现邮件的发送和接收。 JavaMail ...
Javamail邮件开发 OA办公系统-邮件管理模块是一个小型的练习项目,运用java开发语言,MyEclipse 6.5开发工具,MySQL数据库。实现的功能是:对收件箱和发件箱中的邮件进行查询,删除,查看邮件详情和更改邮件已读未读...
【javamail邮件发送项目】是一个基于Java技术的邮件发送解决方案,主要利用Spring框架进行配置,结合FreeMarker(FTL)模板技术实现邮件内容的动态生成,并具备异步发送及批量处理邮件的能力,最多可同时处理1000份...
JavaMail邮件服务是Java开发中用于发送和接收电子邮件的标准库,它基于SMTP(Simple Mail Transfer Protocol)和POP3(Post Office Protocol version 3)等协议,使得开发者能够方便地集成邮件功能到Java应用程序中...
JavaMail邮件实战开发资料主要涉及的是使用Java编程语言发送和接收电子邮件的技术。JavaMail是一个开源API,它提供了在Java应用程序中处理电子邮件的功能。这个资料可能是针对开发者,特别是那些需要在项目中集成...
在Java Web开发中,使用JavaMail API可以实现邮件的发送和接收功能。JavaMail是一个开源库,它提供了标准的API来处理SMTP(简单邮件传输协议)和其他邮件协议,使得开发者能够在应用程序中方便地发送和接收电子邮件...