How to connect to IMAP mail server using java ?
Hello Friends,
I need to include a mailing facility in my application. Now its not the smtp server instead I have to connect to the IMAP server.
Pls provide your valuable suggestions as to how do I go about this ?
What API will I need to download ?? As javamail API does not have IMAP package.
Thank you for your attention.
Regards
What API will I need to download ?? As javamail API does not have IMAP package.What gave you that idea? JavaMail does support IMAP.
Similar Messages
-
Error when connecting to IMAP mail server - untrus...
I am using a Nokia N97 with the v21 firmware.
I am connecting to a mail server via IMAP, using the phone's mail client (not mail for exchange). This has previously worked perfectly, however now I cannot update my inbox and view the emails.
When I try to update the inbox, I get a dialogue box that says "Website has sent an untrusted certificate". After choosing "allow permanently", the inbox does not update. The message comes up every time I try to update (even when I've previously chosen "allow permanently".
I can however successfully send emails via the SMTP server using the phone (IMAP for sending is restricted, so have to use SMTP).
Does anyone have any ideas on why this is happening, and how I can solve it? I've also contacted the IT guys for the mail server, as I'm not sure whether the problem lies with the mail server or the phone, or both.Make sure you are using right security protocol, for IMAP you need to enable TLS/SSL. Go to email settings> Incoming mail > Security.
If a reply has solved your problem click Accept as solution button, doing it will help others know the solution. Thanks. -
Please a program to connect to IMAP mail server
Hi All,
I am using the following program to connect to my organization's imap mail server..
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class readm
public static void main(String args[]) throws MessagingException
Properties props =System.getProperties();
props.put("mail.imap.host","gwes.wide.corp.gwes.com " );
Session session = Session.getDefaultInstance(props, null);
session.setDebug(true);
Store store = session.getStore("imap");
System.out.println("IMAP");
store.connect("gwes.wide.corp.gwes.com ", 25 , "user", "password");
}and get the below exception..
DEBUG: setDebug: JavaMail version 1.4.1
DEBUG: getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc]
DEBUG: mail.imap.fetchsize: 16384
IMAP
220 gwes.wide.corp.gwes.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Sat, 6 Sep 2008 18:07:06 -0400
Exception in thread "main" javax.mail.MessagingException: 220 gwes.wide.corp.gwes.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Sat, 6 Sep 2008 18:07:06 -0400 ;
nested exception is:
com.sun.mail.iap.ConnectionException: 220 gwes.wide.corp.gwes.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Sat, 6 Sep 2008 18:07:06 -0400
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:569)
at javax.mail.Service.connect(Service.java:288)
at readm.main(readm.java:16)
Caused by: com.sun.mail.iap.ConnectionException: 220 gwes.wide.corp.gwes.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Sat, 6 Sep 2008 18:07:06 -0400
at com.sun.mail.imap.protocol.IMAPProtocol.processGreeting(IMAPProtocol.java:230)
at com.sun.mail.iap.Protocol.<init>(Protocol.java:114)
at com.sun.mail.imap.protocol.IMAPProtocol.<init>(IMAPProtocol.java:104)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:538)
... 2 moreI have posted this already in Java Essentials > Java Programming
but I have not got any solution there. Please help me to correct this code or else give me a code that you feel work with an imap mail server at all conditions , I am running this code in unix. Any help would be a great one....
Advance thanks..Thankyou for trying to help me...
bshannon wrote:
The FAQ has debugging tips for debugging connection problems.
Did you try them? What happened?Please find in my code.. I have set debuggging(session.setDebug(true);)
I tried to telnet Here is the output
telnet gwes.wide.corp.gwes.com 25
Trying 148.86.36.29...
Connected to gwes.wide.corp.gwes.com .
Escape character is '^]'.
220 gwes.wide.corp.gwes.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Thu, 4 Sep 2008 16:53:24 -0400
quit
221 2.0.0 gwes.wide.corp.gwes.com Service closing transmission channel
Connection closed by foreign host.This means the server accepts conection through port 25. is not it?
"Conection refused" usually means one of:
1. There's no IMAP server on that host.
2. The IMAP server only accepts connections on the secure port.
3. There's a firewall preventing you from connecting.So when I use the 25 port explicitly, I am not getting any conection refused exception, so I need not analyze for the solution in the lines of connection refused. am I right ?
Advance Thanks.. -
How to connect to a FTP server using a proxy in a DMZ with XI file adapter?
Hello,
Want to connect to an ftp server using a proxy in the DMZ. I don't see any standard options in the XI file adapter to use a standard. Is there a workaround?
I already looked at https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action?pageId=57137
But it didn't help me.
Regards,
Erik van LisdonkU can't use FTP over SSH i.e., SFTP. But u may use FTPS by enabling the SSL layer on J2EE of XI. See this
SFTP vs. FTPS in SAP PI
Regards,
Prateek -
Not able to connect to Lotus Domino server using java/corba
Hi
I am new to Lotus Domino server and Java.
I have INstalled Lotus Domino server5 on 1 machine and was successful in installing the Lotus client on another machine.
Throught the lotus client i am able to connect to the server and send and receive the mails.
Now I want to connect to the domino server using the Lotus Domino Tolkit for Java/Corba.
In this Toolkit they have given the sample code program ..
if I run the code I am getting the error
java.io.FileNotFoundException: http://<IPADDRESS>/diiop_ior.txtjava.io.FileNotFoundException: http://<IPADDRESS>/diiop_ior.txt
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:691)
at java.net.URL.openStream(URL.java:942)
at lotus.domino.NotesFactory.getIOR(NotesFactory.java:314)
at lotus.domino.NotesFactory.createSession(NotesFactory.java:66)
at IntroCorbaApp.run(IntroCorbaApp.java:65)
at java.lang.Thread.run(Thread.java:539)
lotus.domino.NotesException: Could not get IOR from HTTP Server
lotus.domino.NotesException
at lotus.domino.NotesFactory.getIOR(NotesFactory.java:344)
at lotus.domino.NotesFactory.createSession(NotesFactory.java:66)
at IntroCorbaApp.run(IntroCorbaApp.java:65)
at java.lang.Thread.run(Thread.java:539)
I also tried to find this file in the Domino server directory.
The file exists in drive:\LotusServer\Domino\Data\Domino\HTML directory..
I am not getting what exactly is the Problem
Plz any one help me in this regard..
thanks in advanceYou should be able to access the diiop_ior.txt file from browser without authentication,only then it will work. This file should not
be protected. -
Connecting to SMTP mail server using user name and password in java
Hi,
I am trying to send mail using SMTP server in java.
But my SMTP server only allows valid users to send mails. I need a way to pass my user name and password to my SMTP server.
How do I do this ?
Thank you
RameshI think the client is not able to do a HTTP POST
to the WLS server but it can do a HTTP GET.
I dont know why.
http://manojc.com
"Ganesh" <[email protected]> wrote in message
news:3eba91bc$[email protected]..
>
Hi,
I deployed a rpc web service using WLS 7.0 SP2 in HP-UX 11 environment.When I
invoke the web service through my browser (IE 6.0) using the web servicesurl,
it brings my service method correctly. From there, if I click the invokebutton
it asks me for a network user name and password under "weblogic" realm???If I
provide the admin user credentials (which I supplied while creating mydomain)
it is not accepting that it keeps popping up this network user passwordwindow
over and over. Not sure which username/password I have to provide here tosee
the result of my service.
If I try to invoke the web service through my client (static) I am gettinga connection
refused exception. I guess either way, I am not able to access my webservice.
In the attached file, I have cut and pasted the client stack trace as wellas
the server log trace from weblogic.
Any ideas would be highly appreciated.
Thanks,
Ganesh -
How to connect to MS SQL server using JSP?
Hi, i am new to JSP so i would like to know what is the code to create a connection to MS SQL server.
I am using jakarta-tomcat 4 as my server.
sorry for any inconvenient....
pls help me....This works to start off with but there are more sophisticated/ different ways of doing things,for instance it's best not to access the db via your jsp, rather do this logic in JavaBeans, Servlets or use Struts.Therefore, it's best that you consult with others and find out which is best way to go about creating your web apps.
Here's some code:
In my jsp's I access the bean below , instantiate a statement object and go on from there:
*SOME of the code in the JSP's.
//create bean instance
<jsp:useBean id='dbConn' class='projectsevenhouses.DatabaseConnectionBean ' scope='session' />
//instantiate statement
Statement st = dbConn.getConnection().createStatement();
* JavaBean
package projectsevenhouses;
public class DatabaseConnectionBean implements Serializable {
private Connection conn;
private Statement st;
private String dbURL = "jdbc:odbc:datasource";
private static String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
/** Creates a new instance of DatabaseConnectionBean */
public DatabaseConnectionBean() {
makeConnection();
public void setDatabaseName(String dbName) {
dbURL = dbName;
private void makeConnection() {
try {
Class.forName(driver);
conn = DriverManager.getConnection(dbURL,"sa","");
} catch (SQLException e) {
System.out.println("SQL Cause ->" + e.toString());
} catch (ClassNotFoundException cnf) {
System.out.println("Class Not Found:" + cnf);
public Connection getConnection() {
if (conn == null) {
makeConnection();
return conn;
public void setCloseConnection(boolean close) {
if (close) {
try {
conn.close();
} catch (Exception e) {
conn = null;
Hope it gives u an idea...
Ciao
Ushanta -
How to connect to Window 2003 server using "connect as"
How can I set up Lion to easily connect to specified shares in the windows 2003 server. I want to authenticate as a user other than the one I am logged into on my Macbook? I am setting this up for teachers in a school. The macbook may be used by multiple teachers. Best way (simplest) please.
Hi
Let's pretend the Windows Server has an IP address of 10.10.10.254
Go Menu > Connect to Server > smb://10.10.10.254. When prompted enter the account credentials of a user (username and password) that exists on the Windows Server. Alternatively you could use cifs://10.10.10.254. Either one will do. Assuming no 'silliness' on the Windows Network Administrator's part the share should mount.
For ease of connectivity afterwards you could tick the 'remember password using keychain manager' box. Personally I find keychain manager more trouble than it's worth. However you deal with this as you see fit. If it's multiple users using the same workstation I would not enable the option.
Once mounted you can view the Server Share on the user's Desktop by enabling the option in the Finder. It should appear as a blue-ish drive icon on the Desktop. Add the icon in that User's Login Items in the Accounts Preferences Pane. Think of it a little like the Windows equivalent of "mapping a network drive".
Next time that user logs into their local account and provided the workstation is connected to the same network, the share point should mount.
You could also or alternatively drag the share icon to the right hand side of Dock. Click on it to re-connect to the share after you've disconnected from it.
HTH?
Tony -
WIN - How to Connect to Informix Dynamic Server using Generic Connectivity
Hi All,
I have our Oracle running on Windows 2003 and our Informix 9x running on HP.
We have IBM Informix Client install in Wndows 2003 and connection ODBC setup and connected sucessfully.
The setup are as follows:
1) ODBC
System DSN name: capatibak (connected successfully)
2) C:\oracle\product\10.2.0\db_1\hs\admin
Copy the file inithsodbc.ora to initCAPATIBAK.ora and set the following
HS_FDS_CONNECT_INFO = capatibak
HS_FDS_TRACE_LEVEL = ON
3) Listener.ora setup
(SID_DESC =
(SID_NAME = capatibak)
(ORACLE_HOME = c:\oracle\product\10.2.0\db_1)
(PROGRAM = capatibak)
4) Tnsnames.ora setup
CAPATIBAK =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = pendbdev1)(PORT = 1521))
(CONNECT_DATA =
(SID = CAPATIBAK)
(HS=OK)
5) Shutdown and restart Listener
6) Setup database link and perform connection test.
Return: ORA-12518: TNS:listener could not hand off client connection
Kindly advice if I miss any configuration. I am very new to this kind of setup.
Thanks
StevenProblem solved by using the following documentation:
http://www.niall.litchfield.dial.pipex.com/WhitePapers/SettingUpGenericConnectivity.pdf -
Needed help in: how to import image in InDesign Server using Java Code
New to InDesign Server.
I am not been able to import image to document.
I tried to import image using the sample snippets "PlaceTextFileInFrame.java".
modified the line:
String placefilepath = "C:\\placeFile.txt";
to
String placefilepath = "C:\\Image.jpg";
myTextFrame.place(placefilepath);
Is this the correct way to import image or there is another solution.
1.The image gets imported but i am getting blur image(Zoomed image).
2.The image gets imported to its original image width & height.
3.I need to know how to set the image width & size.My Requirement is-- I ve to connect to msn search page in order retrieve the result set from msn search. The same code which I do pasted below is working for GOOGLE n YAHOO with minor changes.But not for MSN.., Can any one help me.
I've pasted the code for msn..,
import java.io.*;
import java.net.*;
public class File {
public static void main(String[] args) throws IOException {
Socket s = new Socket("search.live.com", 80);
String query = "java";
PrintStream p = new PrintStream(s.getOutputStream());
p.print("GET /results.aspx?q=" + query);
p.print("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0\r\n");
p.print("Connection: close\r\n\r\n");
InputStreamReader in = new InputStreamReader(s.getInputStream());
BufferedReader buffer = new BufferedReader(in);
String line;
while ((line = buffer.readLine()) != null) {
System.out.println(line);
Edited by: Lijo_Java on Jul 13, 2008 9:03 PM -
How to deploy EAR on CE server using Java Support Package Manager
Hello,
I am using CE server where I want to deploy EAR file by using JSPM. I run this program in Drive:\usr\sap\CE1\J00\j2ee\JSPM\go.bat
I have also put the EAR file into the inbox folder Drive:\usr\sap\CE1\SYS\EPS\in but still It does not show me any file to proceed further for deployment.
Does any one has idea?
Regards,
NKHi,
The Java Support Package Manager is not able to deploy a single .ear file.
If the *.EAR file is placed inside an SCA (Software Component Archive) then JSPM is able to deploy it.
You have to create a .SCA from an .EAR file
SAP note 1223957 contains an attachment (nwpacktool.zip) which can be used to create a .SCA file from the .EAR file.
Gerd -
I can't set up gmail in my iPad 2. Keep on saying ' can't connect with SSL and ask me whether to connect without using SSL, then I press 'yes' and it said again IMAP is not working and tell me to see network connection and incoming mail server. No idea how to do anymore. Already tried to figure out. But not work. Can anyone pls help me?
Nope, doesn't pass verification. I get the spinner for a minute or so, then the alert about setting it up without SSL. Are you suggesting I disable Fetch and Push BEFORE I enter the account details? Because I never get past the account details screen, unless I choose "Set up without SSL" after the warning.
-
MacBook Pro, late 2011 version. Up to date Mountain Lion.
My email account in the Mail.app is set up as IMAP, but when I delete emails in the Mac Mail App, they are not deleted from the mail clients of the other devices that are connected to the mail server with IMAP. IMAP works perfectly between Windows Outlook 2010, iPad Mail App and Android default mail client. Deleted messages behave correctly, as in delete from one device and the mail is deleted from all devices.
Having just tested in reverse order on the Mac; emails deleted from the email client on Windows, iPad and Android are not deleted in the Mac Mail App. It appears that the account is behaving like POP rather than IMAP.
Any advice on how to have IMAP work correctly on the MacBook Pro Mail.app?
Thank you.Hi Csound1, thanks. The email host is 1and1.co.uk, however, i am going to fess up and make myself look like a plonker now -
the email account in question was set up in Outlook as POP - stupid, stupid, stupid me, wasted an afternoon on this! I have now changed the Outlook account to IMAP and Mail.app works perfectly - and looks much nicer than Outlook did. Im in the middle of converting from Windows to a Mac, and still finding my way around the Mac
The lesson learned, never assume - always double check! All my other email addresses with 1and1 are all imap, except this one, and it happened to be the first one I set up in the Mail.app. (bows head in disgrace!)
Thank you anyway for attempting to help me!
Cheers -
E75 not connecting to corporate (IMAP) mail server
Cannot connect my new E75 to corporate IMAP mail server (Exchange), using SSL/TLS.
I have E71, and this device connects with same settings to corporate email without problems.
The same E75 connects to Gmail perfectly.
The most weird is that it connected once, downloaded three arbitrary emails and that is it, no connection anymore.
I am not using MfE, because I do not like MfE usability, I am using "regular" POP/IMAP version of the email client.
Does anyone have any helpful hints? Thank you!If one searches the web there are many similar problems being faced on this device (E75) - whether you use GroupWise or Exchange. We have used the IMAP client on all previous Nokia phones upto and including the E71 with total success. That includes accessing the same mail boxes - E71 100% E75 only works with HTML mail - not text or richtext. Nokia representatives have been to our offices and seen the problem - they believe its an incompatibility between the new IMAP client and mail servers - what they don't know - are trying to find out if we can load an older IMAP client -
One would think NOKIA would look into this and let everyone know what the problem is and any solution. This kind of thing without speed communication chases people away from a brand and its hard to get them back.
Nokia please help all the users experiencing problems. -
How to connect to a Sql server from Oracle using db link
Hi All,
Does anybody have any idea about how to connect to a sql server from oracle database using db link to syncronize the data? I need to pull the data from Sql server table to Oracle tables and relay messages back to the sql server.
Thank you,
Praveen.we have 2 products - DG4MSQL and DG4ODBC.
DG4ODBC is for free and requires a 3rd party ODBC driver and it can connect to any 3rd party database as long as you use a suitable ODBC driver
DG4MSQL is more powerfull as it is designed for MS SQL Server databases and it supports many functions it can directly map to SQL Server equivalents - it can also call remote procedures or participtae in distributed transactions. Please be aware DG4MSQL requires a license - it is not for free.
Check out Metalink and you'll find notes how to configure both products.
For a generic overview:
Note.233876.1 Options for Connecting to Foreign Data Stores and Non-Oracle Databases
And the setup notes:
DG4ODBC
Note.561033.1 How to Setup DG4ODBC on 64bit Unix OS (Linux, Solaris, AIX, HP-UX) :
Note.466225.1 How to Setup DG4ODBC (Oracle Database Gateway for ODBC) on Windows 32bit RDBMS.HS-3-2 :
Note.109730.1 How to setup generic connectivity (HSODBC) for 32 bit Windows (Windows NT, Windows 2000, Windows XP, Windows 2003) V817:
Note.466228.1 How to Setup DG4ODBC on Linux x86 32bit
DG4MSQL
Note.466267.1 How to Setup DG4MSQL (Database Gateway for MS SQL Server) on Windows 32bit
Note.562509.1 How to Setup DG4MSQL (Oracle Database Gateway for MS SQL Server) 64bit Unix OS (Linux, Solaris, AIX,HP-UX)
Note.437374.1 How to Setup DG4MSQL (Oracle Database Gateway for MS SQL Server) Release 11 on Linux
Maybe you are looking for
-
Completely broken in Ubuntu: can't access profile
I have a freshly installed Ubuntu 13.04 64bit. It came with Firefox 20 which was working fine, but was not the latest version. I ran "sudo apt-get install firefox" and it updated firefox to version 24. Now Firefox is broken and won't load. It systema
-
How do I uninstall 10.5.7?
Is there a way to uninstall 10.5.7 and go back to 10.5.6? I know it is possible to revert back on a PC, so I am thinking that it is probably possible on a Mac too, but I cannot figure out how. Any help would be appreciated. Thanks, Jonathan
-
Function returning control via CType. Is this risk-free?
I want an easy way to get a TabPage's child (user)control without writing CType() functions everywhere. For this I created a function that returns the control via CType: Private Function ChildIRCControl() As IRCControl Return CType(Me.TabControl1.Tab
-
Tree Control --- Urgent help needed
Hi all, I want to display a screen , where there are 2 parts. A tree structure on the left of my screen and on clikcing on one node, I want screen x to be displayed on the right side of the screen. On clikcing on other node, then screen y has to be d
-
SCCM 2007 BDP Status Exact Meaning
What are exact meaning of BDP Status below (0,1,2,3,4) BDP_Status When Status = 0 Then 'Healthy' When Status = 1 Then 'Warning' When Status = 2 AND AvailabilityState = 3 Then 'Critical' When Status = 2 AND AvailabilityState = 4 Then 'Very