javamail - 协议SMTP\IMAP\POP3设置
资料来自:https://www.tutorialspoint.com/javamail_api/index.htm
【SMTP - Simple Mail Transfer Protocol】
Name | Type | Description |
---|---|---|
mail.smtp.user | String | Default user name for SMTP. |
mail.smtp.host | String | The SMTP server to connect to. |
mail.smtp.port | int | The SMTP server port to connect to, if the connect() method doesn't explicitly specify one. Defaults to 25. |
mail.smtp.connectiontimeout | int | Socket connection timeout value in milliseconds. Default is infinite timeout. |
mail.smtp.timeout | int | Socket I/O timeout value in milliseconds. Default is infinite timeout. |
mail.smtp.from | String | Email address to use for SMTP MAIL command. This sets the envelope return address. Defaults to msg.getFrom() or InternetAddress.getLocalAddress(). |
mail.smtp.localhost | String | Local host name used in the SMTP HELO or EHLO command. Defaults to InetAddress.getLocalHost().getHostName(). Should not normally need to be set if your JDK and your name service are configured properly. |
mail.smtp.localaddress | String | Local address (host name) to bind to when creating the SMTP socket. Defaults to the address picked by the Socket class. Should not normally need to be set. |
mail.smtp.localport | int | Local port number to bind to when creating the SMTP socket. Defaults to the port number picked by the Socket class. |
mail.smtp.ehlo | boolean | If false, do not attempt to sign on with the EHLO command. Defaults to true. |
mail.smtp.auth | boolean | If true, attempt to authenticate the user using the AUTH command. Defaults to false. |
mail.smtp.auth.mechanisms | String | If set, lists the authentication mechanisms to consider. Only mechanisms supported by the server and supported by the current implementation will be used. The default is "LOGIN PLAIN DIGEST-MD5 NTLM", which includes all the authentication mechanisms supported by the current implementation. |
mail.smtp.auth.login.disable | boolean | If true, prevents use of the AUTH LOGIN command. Default is false. |
mail.smtp.auth.plain.disable | boolean | If true, prevents use of the AUTH PLAIN command. Default is false. |
mail.smtp.auth.digest-md5.disable | boolean | If true, prevents use of the AUTH DIGEST-MD5 command. Default is false. |
mail.smtp.auth.ntlm.disable | boolean | If true, prevents use of the AUTH NTLM command. Default is false. |
mail.smtp.auth.ntlm.domain | String | The NTLM authentication domain. |
mail.smtp.auth.ntlm.flags | int | NTLM protocol-specific flags. |
mail.smtp.submitter | String | The submitter to use in the AUTH tag in the MAIL FROM command. Typically used by a mail relay to pass along information about the original submitter of the message. |
mail.smtp.dsn.notify | String | The NOTIFY option to the RCPT command. Either NEVER, or some combination of SUCCESS, FAILURE, and DELAY (separated by commas). |
mail.smtp.dsn.ret | String | The RET option to the MAIL command. Either FULL or HDRS. |
mail.smtp.sendpartial | boolean | If set to true, and a message has some valid and some invalid addresses, send the message anyway, reporting the partial failure with a SendFailedException. If set to false (the default), the message is not sent to any of the recipients if there is an invalid recipient address. |
mail.smtp.sasl.enable | boolean | If set to true, attempt to use the javax.security.sasl package to choose an authentication mechanism for login. Defaults to false. |
mail.smtp.sasl.mechanisms | String | A space or comma separated list of SASL mechanism names to try to use. |
mail.smtp.sasl.authorizationid | String | The authorization ID to use in the SASL authentication. If not set, the authentication ID (user name) is used. |
mail.smtp.sasl.realm | String | The realm to use with DIGEST-MD5 authentication. |
mail.smtp.quitwait | boolean | If set to false, the QUIT command is sent and the connection is immediately closed. If set to true (the default), causes the transport to wait for the response to the QUIT command. |
mail.smtp.reportsuccess | boolean | If set to true, causes the transport to include an SMTPAddressSucceededException for each address that is successful. |
mail.smtp.socketFactory | Socket Factory | If set to a class that implements the javax.net.SocketFactory interface, this class will be used to create SMTP sockets. |
mail.smtp.socketFactory.class | String | If set, specifies the name of a class that implements the javax.net.SocketFactory interface. This class will be used to create SMTP sockets. |
mail.smtp.socketFactory.fallback | boolean | If set to true, failure to create a socket using the specified socket factory class will cause the socket to be created using the java.net.Socket class. Defaults to true. |
mail.smtp.socketFactory.port | int | Specifies the port to connect to when using the specified socket factory. If not set, the default port will be used. |
mail.smtp.ssl.enable | boolean | If set to true, use SSL to connect and use the SSL port by default. Defaults to false for the "smtp" protocol and true for the "smtps" protocol. |
mail.smtp.ssl.checkserveridentity | boolean | If set to true, checks the server identity as specified by RFC 2595. Defaults to false. |
mail.smtp.ssl.trust | String | If set, and a socket factory hasn't been specified, enables use of a MailSSLSocketFactory. If set to "*", all hosts are trusted. If set to a whitespace separated list of hosts, those hosts are trusted. Otherwise, trust depends on the certificate the server presents. |
mail.smtp.ssl.socketFactory | SSL Socket Factory | If set to a class that extends the javax.net.ssl.SSLSocketFactory class, this class will be used to create SMTP SSL sockets. |
mail.smtp.ssl.socketFactory.class | String | If set, specifies the name of a class that extends the javax.net.ssl.SSLSocketFactory class. This class will be used to create SMTP SSL sockets. |
mail.smtp.ssl.socketFactory.port | int | Specifies the port to connect to when using the specified socket factory. If not set, the default port will be used. |
mail.smtp.ssl.protocols | string | Specifies the SSL protocols that will be enabled for SSL connections. The property value is a whitespace separated list of tokens acceptable to the javax.net.ssl.SSLSocket.setEnabledProtocols method. |
mail.smtp.starttls.enable | boolean | If true, enables the use of the STARTTLS command (if supported by the server) to switch the connection to a TLS-protected connection before issuing any login commands. Defaults to false. |
mail.smtp.starttls.required | boolean | If true, requires the use of the STARTTLS command. If the server doesn't support the STARTTLS command, or the command fails, the connect method will fail. Defaults to false. |
mail.smtp.socks.host | string | Specifies the host name of a SOCKS5 proxy server that will be used for connections to the mail server. |
mail.smtp.socks.port | string | Specifies the port number for the SOCKS5 proxy server. This should only need to be used if the proxy server is not using the standard port number of 1080. |
mail.smtp.mailextension | String | Extension string to append to the MAIL command. |
mail.smtp.userset | boolean | If set to true, use the RSET command instead of the NOOP command in the isConnected method. In some cases sendmail will respond slowly after many NOOP commands; use of RSET avoids this sendmail issue. Defaults to false. |
【IMAP - Internet Message Access Protocol】
Name | Type | Description |
---|---|---|
mail.imap.user | String | Default user name for IMAP. |
mail.imap.host | String | The IMAP server to connect to. |
mail.imap.port | int | The IMAP server port to connect to, if the connect() method doesn't explicitly specify one. Defaults to 143. |
mail.imap.partialfetch | boolean | Controls whether the IMAP partial-fetch capability should be used. Defaults to true. |
mail.imap.fetchsize | int | Partial fetch size in bytes. Defaults to 16K. |
mail.imap.ignorebodystructuresize | boolean | The IMAP BODYSTRUCTURE response includes the exact size of each body part. Normally, this size is used to determine how much data to fetch for each body part. Defaults to false. |
mail.imap.connectiontimeout | int | Socket connection timeout value in milliseconds. Default is infinite timeout. |
mail.imap.timeout | int | Socket I/O timeout value in milliseconds. Default is infinite timeout. |
mail.imap.statuscachetimeout | int | Timeout value in milliseconds for cache of STATUS command response. Default is 1000 (1 second). Zero disables cache. |
mail.imap.appendbuffersize | int | Maximum size of a message to buffer in memory when appending to an IMAP folder. |
mail.imap.connectionpoolsize | int | Maximum number of available connections in the connection pool. Default is 1. |
mail.imap.connectionpooltimeout | int | Timeout value in milliseconds for connection pool connections. Default is 45000 (45 seconds). |
mail.imap.separatestoreconnection | boolean | Flag to indicate whether to use a dedicated store connection for store commands. Default is false. |
mail.imap.auth.login.disable | boolean | If true, prevents use of the non-standard AUTHENTICATE LOGIN command, instead using the plain LOGIN command. Default is false. |
mail.imap.auth.plain.disable | boolean | If true, prevents use of the AUTHENTICATE PLAIN command. Default is false. |
mail.imap.auth.ntlm.disable | boolean | If true, prevents use of the AUTHENTICATE NTLM command. Default is false. |
mail.imap.proxyauth.user | String | If the server supports the PROXYAUTH extension, this property specifies the name of the user to act as. Authenticate to the server using the administrator's credentials. After authentication, the IMAP provider will issue the PROXYAUTH command with the user name specified in this property. |
mail.imap.localaddress | String | Local address (host name) to bind to when creating the IMAP socket. Defaults to the address picked by the Socket class. |
mail.imap.localport | int | Local port number to bind to when creating the IMAP socket. Defaults to the port number picked by the Socket class. |
mail.imap.sasl.enable | boolean | If set to true, attempt to use the javax.security.sasl package to choose an authentication mechanism for login. Defaults to false. |
mail.imap.sasl.mechanisms | String | A space or comma separated list of SASL mechanism names to try to use. |
mail.imap.sasl.authorizationid | String | The authorization ID to use in the SASL authentication. If not set, the authentication ID (user name) is used. |
mail.imap.sasl.realm | String | The realm to use with SASL authentication mechanisms that require a realm, such as DIGEST-MD5. |
mail.imap.auth.ntlm.domain | String | The NTLM authentication domain. |
mail.imap.auth.ntlm.flags | int | NTLM protocol-specific flags. |
mail.imap.socketFactory | Socket Factory | If set to a class that implements the javax.net.SocketFactory interface, this class will be used to create IMAP sockets. |
mail.imap.socketFactory.class | String | If set, specifies the name of a class that implements the javax.net.SocketFactory interface. This class will be used to create IMAP sockets. |
mail.imap.socketFactory.fallback | boolean | If set to true, failure to create a socket using the specified socket factory class will cause the socket to be created using the java.net.Socket class. Defaults to true. |
mail.imap.socketFactory.port | int | Specifies the port to connect to when using the specified socket factory. Default port is used when not set. |
mail.imap.ssl.enable | boolean | If set to true, use SSL to connect and use the SSL port by default. Defaults to false for the "imap" protocol and true for the "imaps" protocol. |
mail.imap.ssl.checkserveridentity | boolean | If set to true, check the server identity as specified by RFC 2595. Defaults to false. |
mail.imap.ssl.trust | String | If set, and a socket factory hasn't been specified, enables use of a MailSSLSocketFactory. If set to "*", all hosts are trusted. If set to a whitespace separated list of hosts, those hosts are trusted. Otherwise, trust depends on the certificate the server presents. |
mail.imap.ssl.socketFactory | SSL Socket Factory | If set to a class that extends the javax.net.ssl.SSLSocketFactory class, this class will be used to create IMAP SSL sockets. |
mail.imap.ssl.socketFactory.class | String | If set, specifies the name of a class that extends the javax.net.ssl.SSLSocketFactory class. This class will be used to create IMAP SSL sockets. |
mail.imap.ssl.socketFactory.port | int | Specifies the port to connect to when using the specified socket factory. If not set, the default port will be used. |
mail.imap.ssl.protocols | string | Specifies the SSL protocols that will be enabled for SSL connections. The property value is a whitespace separated list of tokens acceptable to the javax.net.ssl.SSLSocket.setEnabledProtocols method. |
mail.imap.starttls.enable | boolean | If true, enables the use of the STARTTLS command (if supported by the server) to switch the connection to a TLS-protected connection before issuing any login commands. Default is false. |
mail.imap.starttls.required | boolean | If true, requires the use of the STARTTLS command. If the server doesn't support the STARTTLS command, or the command fails, the connect method will fail. Defaults to false. |
mail.imap.socks.host | string | Specifies the host name of a SOCKS5 proxy server that will be used for connections to the mail server. |
mail.imap.socks.port | string | Specifies the port number for the SOCKS5 proxy server. This should only need to be used if the proxy server is not using the standard port number of 1080. |
mail.imap.minidletime | int | This property sets the delay in milliseconds. If not set, the default is 10 milliseconds. |
mail.imap.enableimapevents | boolean | Enable special IMAP-specific events to be delivered to the Store's ConnectionListener. If true, unsolicited responses received during the Store's idle method will be sent as ConnectionEvents with a type of IMAPStore.RESPONSE. The event's message will be the raw IMAP response string. By default, these events are not sent. |
mail.imap.folder.class | String | Class name of a subclass of com.sun.mail.imap.IMAPFolder. The subclass can be used to provide support for additional IMAP commands. The subclass must have public constructors of the form public MyIMAPFolder(String fullName, char separator, IMAPStore store, Boolean isNamespace) and public MyIMAPFolder(ListInfo li, IMAPStore store) |
【POP3 - Post Office Protocol】
Name | Type | Description |
---|---|---|
mail.pop3.user | String | Default user name for POP3. |
mail.pop3.host | String | The POP3 server to connect to. |
mail.pop3.port | int | The POP3 server port to connect to, if the connect() method doesn't explicitly specify one. Defaults to 110. |
mail.pop3.connectiontimeout | int | Socket connection timeout value in milliseconds. Default is infinite timeout. |
mail.pop3.timeout | int | Socket I/O timeout value in milliseconds. Default is infinite timeout. |
mail.pop3.rsetbeforequit | boolean | Send a POP3 RSET command when closing the folder, before sending the QUIT command. Default is false. |
mail.pop3.message.class | String | Class name of a subclass of com.sun.mail.pop3.POP3Message. The subclass can be used to handle (for example) non-standard Content-Type headers. The subclass must have a public constructor of the form MyPOP3Message(Folder f, int msgno) throws MessagingException. |
mail.pop3.localaddress | String | Local address (host name) to bind to when creating the POP3 socket. Defaults to the address picked by the Socket class. |
mail.pop3.localport | int | Local port number to bind to when creating the POP3 socket. Defaults to the port number picked by the Socket class. |
mail.pop3.apop.enable | boolean | If set to true, use APOP instead of USER/PASS to login to the POP3 server, if the POP3 server supports APOP. APOP sends a digest of the password rather than the clear text password. Defaults to false. |
mail.pop3.socketFactory | Socket Factory | If set to a class that implements the javax.net.SocketFactory interface, this class will be used to create POP3 sockets. |
mail.pop3.socketFactory.class | String | If set, specifies the name of a class that implements the javax.net.SocketFactory interface. This class will be used to create POP3 sockets. |
mail.pop3.socketFactory.fallback | boolean | If set to true, failure to create a socket using the specified socket factory class will cause the socket to be created using the java.net.Socket class. Defaults to true. |
mail.pop3.socketFactory.port | int | Specifies the port to connect to when using the specified socket factory. If not set, the default port will be used. |
mail.pop3.ssl.enable | boolean | If set to true, use SSL to connect and use the SSL port by default. Defaults to false for the "pop3" protocol and true for the "pop3s" protocol. |
mail.pop3.ssl.checkserveridentity | boolean | If set to true, check the server identity as specified by RFC 2595. Defaults to false. |
mail.pop3.ssl.trust | String | If set, and a socket factory hasn't been specified, enables use of a MailSSLSocketFactory. If set to "*", all hosts are trusted. If set to a whitespace separated list of hosts, those hosts are trusted. Otherwise, trust depends on the certificate the server presents. |
mail.pop3.ssl.socketFactory | SSL Socket Factory | If set to a class that extends the javax.net.ssl.SSLSocketFactory class, this class will be used to create POP3 SSL sockets. |
mail.pop3.ssl.socketFactory.class | String | If set, specifies the name of a class that extends the javax.net.ssl.SSLSocketFactory class. This class will be used to create POP3 SSL sockets. |
mail.pop3.ssl.socketFactory.port | int | Specifies the port to connect to when using the specified socket factory. If not set, the default port will be used. |
mail.pop3.ssl.protocols | string | Specifies the SSL protocols that will be enabled for SSL connections. The property value is a whitespace separated list of tokens acceptable to the javax.net.ssl.SSLSocket.setEnabledProtocols method. |
mail.pop3.starttls.enable | boolean | If true, enables the use of the STLS command (if supported by the server) to switch the connection to a TLS-protected connection before issuing any login commands. Defaults to false. |
mail.pop3.starttls.required | boolean | If true, requires the use of the STLS command. If the server doesn't support the STLS command, or the command fails, the connect method will fail. Defaults to false. |
mail.pop3.socks.host | string | Specifies the host name of a SOCKS5 proxy server that will be used for connections to the mail server. |
mail.pop3.socks.port | string | Specifies the port number for the SOCKS5 proxy server. |
mail.pop3.disabletop | boolean | If set to true, the POP3 TOP command will not be used to fetch message headers. Defaults to false. |
mail.pop3.forgettopheaders | boolean | If set to true, the headers that might have been retrieved using the POP3 TOP command will be forgotten and replaced by headers retrieved as part of the POP3 RETR command. Defaults to false. |
mail.pop3.filecache.enable | boolean | If set to true, the POP3 provider will cache message data in a temporary file rather than in memory. Messages are only added to the cache when accessing the message content. Message headers are always cached in memory (on demand). The file cache is removed when the folder is closed or the JVM terminates. Defaults to false. |
mail.pop3.filecache.dir | String | If the file cache is enabled, this property can be used to override the default directory used by the JDK for temporary files. |
mail.pop3.cachewriteto | boolean | Controls the behavior of the writeTo method on a POP3 message object. If set to true, and the message content hasn't yet been cached, and ignoreList is null, the message is cached before being written. Otherwise, the message is streamed directly to the output stream without being cached. Defaults to false. |
mail.pop3.keepmessagecontent | boolean | If this property is set to true, a hard reference to the cached content will be kept, preventing the memory from being reused until the folder is closed or the cached content is explicitly invalidated (using the invalidate method). Defaults to false. |
javamail - 协议SMTP\IMAP\POP3设置的更多相关文章
- 常用邮箱的 IMAP/POP3/SMTP 设置
通过网上查找的资料和自己的总结完成了下面的文章,看完之后相信大家对这三种协议会有更深入的理解.如有错误的地方望指正. POP3 POP3是Post Office Protocol 3的简称,即邮局协议 ...
- 理解邮件传输协议(SMTP、POP3、IMAP、MIME)
http://blog.csdn.net/xyang81/article/details/7672745 电子邮件需要在邮件客户端和邮件服务器之间,以及两个邮件服务器之间进行传递,就必须遵循一定的规则 ...
- 【转】常用邮箱的 IMAP/POP3/SMTP 设置
POP3 POP3是Post Office Protocol 3的简称,即邮局协议的第3个版本,它规定怎样将个人计算机连接到Internet的邮件服务器和下载电子邮件的电子协议.它是因特网电子邮件的第 ...
- 电子邮件的三个协议: SMTP、IMAP、POP3
个人总结: 读完这篇文章需要10分钟 讲解了跟电子邮件有关的三个协议: SMTP(simple message transfer protocol 简单信息传输协议 IMAP (internet me ...
- SMTP、POP3和IMAP邮件协议
目录 SMTP POP IMAP 总结 DNS记录中的MX记录 今天入职第一天,公司让配置个人的内网.外网邮箱,这可把我给搞晕了,本来以前就对邮箱这块不是很了解,平时也不怎么用邮箱,顶多有个QQ邮箱而 ...
- POP3&SMTP&IMAP
[POP3&SMTP&IMAP] IMAP是什么? IMAP,即Internet Message Access Protocol(互联网邮件访问协议),您可以通过这种协议从邮件服务器上 ...
- 邮件实现详解(二)------手工体验smtp和pop3协议
上篇博客我们简单介绍了电子邮件的发送和接收过程,对参与其中的邮件服务器,邮件客户端软件,邮件传输协议也有简单的介绍.我们知道电子邮件需要在邮件客户端和邮件服务器之间,以及两个邮件服务器之间进行传递必须 ...
- 电子邮件协议:SMTP、POP3、IMAP4
常见的电子邮件协议:SMTP.POP3.IMAP4 邮件发送协议:SMTP协议 邮件读取协议:POP3.IMAP4协议 SMTP协议(simple mail transfer protocol ...
- 你真的了解电子邮件系统的组成和结构吗?(SMTP、POP3、IMAP、MIME……)
文章转自:https://blog.csdn.net/weixin_43914604/article/details/105896201 学习课程:<2019王道考研计算机网络> 学习目的 ...
随机推荐
- 关于fragment+viewpager的优化
上次写了一个问答项目,用的fragment+viewpager架构,后来发现,划了几次之后,再划回来,会重新加载布局,重新获取数据,这样整个程序和卡,并且占用太多的网络资源. 当时的解决办法是,自己重 ...
- STL源码分析之第二级配置器
前言 第一级是直接调用malloc分配空间, 调用free释放空间, 第二级三就是建立一个内存池, 小于128字节的申请都直接在内存池申请, 不直接调用malloc和free. 本节分析第二级空间配置 ...
- 洛谷——P1342 请柬
P1342 请柬 题目描述 在电视时代,没有多少人观看戏剧表演.Malidinesia古董喜剧演员意识到这一事实,他们想宣传剧院,尤其是古色古香的喜剧片.他们已经打印请帖和所有必要的信息和计划.许多学 ...
- [Luogu] P1993 小K的农场
题目描述 小K在MC里面建立很多很多的农场,总共n个,以至于他自己都忘记了每个农场中种植作物的具体数量了,他只记得一些含糊的信息(共m个),以下列三种形式描述: 农场a比农场b至少多种植了c个单位的作 ...
- vue v-model 的注意点
在使用表单元素 input 的 v-model 指令时,碰到一个问题: 如上图,修改 input 的内容,以便随时显示:但显示时明显慢一步. <template> <div> ...
- accept阻塞
一直以来以为accept阻塞的时候,若另有线程关闭相应的监听套接字,accept会立即返回. 今天先是在NDK上试,没反应.又在ARCHLINUX试了下,还是没反应.难道是我一直记的都是错的!!!!! ...
- 洛谷 3959 宝藏 NOIP2017提高组Day2 T2
[题解] 状压DP. f[i]表示现在的点是否连接的状态是i. #include<cstdio> #include<cstring> #include<algorithm ...
- log4j.properties配置内容的理解
一直知道log4j是用来记录日志的,但一直没去看log4j到底是怎么用的,这两天看了几个log4j.properties配置语句详解的帖子,在这里简陋地记录一下. 在完全不知道log4j怎么用的时候, ...
- https://segmentfault.com/a/1190000012844836---------关于SpringBoot上传图片的几种方式
关于SpringBoot上传图片的几种方式 https://segmentfault.com/a/1190000012844836
- hdu 2014 位运算
/* 注意两点 1.从后往前找互补的,刚开始我找的是相邻的但是这个例子就不行101 110 2.因为时累加所以sum可能会超出int范围,这个很重要. */ #include<stdio.h&g ...