JavaMail installation and configuration frequently asked questions

Source: Internet
Author: User
Tags ftp imap include firewall linux

Q. How do I install the JavaMail API implementation?

A: Unzip the distributed zip file and edit the CLASSPATH environment variable to include the Mail.jar file, which is included in the JavaMail API distribution. You also need the implementation of the JavaBeans activation Framework (see below). See the Readme file (in distribution) for additional details and examples.

Q. Does JavaMail include all the necessary mail servers?

A: No, the JavaMail API package does not include any mail servers. In order to use the JavaMail API package, you will need access to an IMAP or POP3 mail server (for reading mail) and/or an SMTP mail server (for sending mail). These mail servers are typically provided by Internet service providers or as part of an organization's network infrastructure. If you do not need to visit such a mail server, please look down.

Q. Where can I get the necessary mail server?

A: The Sun Java System messaging Server is available for Solaris and Windows platforms. The University of Washington IMAP server supports multiple platforms (UNIX, 32-bit Windows, and so on). Source code can be obtained from the following address: Ftp://ftp.cac.washington.edu/imap/imap.tar.Z. Many other vendors provide a mail server that supports Internet standards. More information can be obtained from IMAP Connection and Internet Mail Consortium.

Q. What host name, username, or password should I use?

A: We do not provide a mail server for you to use. You must use your own mail server, or use an Internet service provider or a mail server provided by the company you work for. The network administrator may give you the necessary information to configure the JavaMail to work with the mail server.

Q. How do I configure JavaMail to work through a proxy server?

A: Most proxy servers only support HTTP protocols. JavaMail does not use the HTTP protocol to read or send messages. One of the main reasons for using a proxy server is to allow HTTP requests in the corporate network to pass through the enterprise firewall. Firewalls typically block most access to the Internet, but allow requests from proxy servers to pass. In addition, mail servers within the corporate network perform similar functions for messages, receive messages through SMTP, forward them to their final destinations on the Internet, receive incoming messages, and then send them to the appropriate internal mail server.

If your proxy server supports the SOCKS V4 or V5 protocol (http://www.socks.nec.com/aboutsocks.html, RFC1928) and allows anonymous connections, you can tell the Java runtime to put all the TCP sockets Connect directly to the SOCKS server. See http://java.sun.com/j2se/1.4/docs/guide/net/properties.html for the latest documentation for the Socksproxyhost and Socksproxyport properties. These are system-level attributes, not JavaMail session properties. When the application is invoked, they can be set from the command line, for example: Java-dsocksproxyhost=myproxy .... This tool can be used to indicate SMTP, IMAP, and POP3 communications from JavaMail to socks proxy servers. Note that setting these properties will tell all TCP sockets to connect to the socks agent, which can have a negative impact on other aspects of the application.

If there is no such socks server, if you want to use JavaMail to directly access the mail server outside the firewall, you will need to configure the firewall to allow this access. A simple HTTP proxy Web server is sufficient.

Ask. How do I set up CLASSPATH in Windows NT?

A: Detailed instructions can be obtained from here.

Ask. When trying to run a program in Linux, I get very strange error messages, and the program fails to run. Where is the mistake?

A: Usually, the error message looks like this:

Exception in thread "main"

Java.lang.VerifyError: (Class:com/sun/mail/pop3/pop3store,

Method:finalize Signature:() V)

Illegal use the Nonvirtual function call

The problem is that the unzip command used on Linux is a bug version, so when the JavaMail download package is uncompressed, the unzip command destroys the Mail.jar file. Get the updated version of the unzip command or use the JDK jar command to extract the download package.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.