<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>Hi<BR>
&nbsp;<BR>
I changed the version to 2.44, but the problem remains.<BR>
&nbsp;<BR>
Meanwhile I found another solution to communicate directly from C# to an IMAP server with a very nice&nbsp;freeware library. It also includes some other protocol communication like pop3, smtp, Auth_HttpDigest, dns, ftp, http, icmp, io, log, mime, nntp, sdp and sip.<BR>
&nbsp;<BR>
If you are interested, you can find my writings here <A href="http://www.lumisoft.ee/Forum/default.aspx?g=posts&amp;t=98">http://www.lumisoft.ee/Forum/default.aspx?g=posts&amp;t=98</A><BR>
The example there&nbsp;uses following library <A href="http://www.lumisoft.ee/lsWWW/ENG/Products/WEB_Mail/webmail_index_eng.aspx?type=download">http://www.lumisoft.ee/lsWWW/ENG/Products/WEB_Mail/webmail_index_eng.aspx?type=download</A><BR>
&nbsp;<BR>
Rregards,<BR>
Kris<BR><BR>
<BLOCKQUOTE>
<HR id=EC_stopSpelling>
Date: Wed, 11 Apr 2007 11:18:24 -0400<BR>Subject: Re: [Python.NET] Unable to import library imaplib<BR>From: brian.lloyd@revolution.com<BR>To: kris_beyers@hotmail.com; dvpdiner2@yahoo.com<BR>CC: pythondotnet@python.org<BR><BR>
<META content="Microsoft SafeHTML" name=Generator><FONT face="Verdana, Helvetica, Arial"><SPAN style="FONT-SIZE: 12px">Note that the latest PythonNet is built for and includes 2.4, not 2.5, unless you’ve built <BR>your own version.<BR><BR>That probably means that pythonnet is looking at the PYTHONPATH for 2.4, which <BR>probably doesn’t have imaplib installed.<BR><BR>I’d suggest making sure to install imaplib in the site-packages used by your <BR>PythonNet/2.4 installation...<BR><BR>-Brian<BR><BR><BR>On 4/11/07 5:16 AM, "Kris Beyers" &lt;kris_beyers@hotmail.com&gt; wrote:<BR><BR></SPAN></FONT>
<BLOCKQUOTE><FONT face="Verdana, Helvetica, Arial"><SPAN style="FONT-SIZE: 12px">Hi<BR>&nbsp;<BR>I can import CLR, but not imaplib. Although imaplib is part of the standard python library, and I suppose I didn't need CLR.<BR>I also tried different combinations of case of the word "imaplib", since the import statement is case sensitive.<BR>Currently I have the latest Python version 25, and installed the latest PythonNet afterwards (PythonNet 1.0 release candidate 2).<BR>Also tried to include the path to the C:\Python25\Lib in the systemvariable PATH, where imaplib.py resides.<BR>&nbsp;<BR>Furthermore I included C:\Program Files\PythonNet in the same systemvariable, but that's nog part of the problem I guess.<BR>&nbsp;<BR>Regards,<BR>Kris<BR></SPAN></FONT>
<BLOCKQUOTE><FONT face="Verdana, Helvetica, Arial"><SPAN style="FONT-SIZE: 12px">
<HR align=center width="100%" SIZE=3>
Date: Tue, 10 Apr 2007 19:39:43 -0700<BR>From: dvpdiner2@yahoo.com<BR>Subject: Re: [Python.NET] Unable to import library imaplib<BR>To: kris_beyers@hotmail.com<BR>CC: pythondotnet@python.org<BR><BR>Did you use (in Python)<BR><BR>&gt;&gt;&gt; import clr<BR><BR>to import the Common Language Runtime and support .NET assemblies?<BR>&nbsp;<BR>&nbsp;<A href="http://www.urulive.com/blog/" target=_blank>&lt;http://www.urulive.com/blog/&gt;</A> <BR>Uru Live IRC Chat: unreal.JustIRC.net #uru<BR><BR><BR>----- Original Message ----<BR>From: Kris Beyers &lt;kris_beyers@hotmail.com&gt;<BR>To: pythondotnet@python.org<BR>Sent: Tuesday, April 10, 2007 1:31:35 PM<BR>Subject: [Python.NET] Unable to import library imaplib<BR><BR>Hi<BR>&nbsp;<BR>I'm trying to make a python script (which would be called from a C# application) and communicates with an IMAP server.<BR>Passing variables from C# to python and back is no problem, but when I type "import imaplib" on top of the python script to support IMAP, the script fails to run at line with following code: "func.Invoke(arguments)". Showing error message in the C# developer: "&lt;null reference&gt;".<BR>&nbsp;<BR>I also tried to call PythonEngine.ImportModule("imaplib") first, but no change.<BR>Is there a way to import the library? Thank you in advance.<BR>&nbsp;<BR>Tip: Just found out about an amazing C# developer <A href="http://www.sharpdevelop.net/" target=_blank>http://www.sharpdevelop.net</A> <A href="http://www.sharpdevelop.net/" target=_blank>&lt;http://www.sharpdevelop.net/&gt;</A> &nbsp;(open source)<BR>&nbsp;<BR>Regards,<BR>Kris<BR>&nbsp;<BR>C#<BR>***<BR>try {<BR>&nbsp;string imapUser = "kris";<BR>&nbsp;string imapPassword = "a password";<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;PythonEngine.Initialize();<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;PyObject[] arguments = new PyObject[2];<BR>&nbsp;arguments[0] = PyObject.FromManagedObject(imapUser);<BR>&nbsp;arguments[1] = PyObject.FromManagedObject(imapPassword);<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;PyObject pyportal = PythonEngine.ImportModule("PyPortal");<BR>&nbsp;PyObject func = pyportal.GetAttr("invoker");<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;PyObject result = func.Invoke(arguments);<BR>&nbsp;this.label1.Text = result.ToString();<BR>} catch (Exception err) {<BR>&nbsp;this.label1.Text = err.Message.ToString();<BR>}<BR>&nbsp;<BR>The file PyPortal.py<BR>***************<BR>import imaplib &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# &nbsp;&lt;-- causes error<BR>def invoker(imapUser, imapPassword):<BR>&nbsp;&nbsp;&nbsp;&nbsp;messages = []<BR>&nbsp;&nbsp;&nbsp;&nbsp;M = imaplib.IMAP4('imap.next.mail.yahoo.com')<BR>&nbsp;&nbsp;&nbsp;&nbsp;M.login(imapUser, imapPassword)<BR>&nbsp;&nbsp;&nbsp;&nbsp;M.select()<BR>&nbsp;&nbsp;&nbsp;&nbsp;typ, data = M.search(None, 'ALL')<BR>&nbsp;&nbsp;&nbsp;&nbsp;for num in data[0].split():<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typ, data = M.fetch(num, '(RFC822)')<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;messages.append('Message %s\n%s\n' % (num, data[0][1]))<BR>&nbsp;&nbsp;&nbsp;&nbsp;M.close()<BR>&nbsp;&nbsp;&nbsp;&nbsp;M.logout()<BR>&nbsp;&nbsp;&nbsp;&nbsp;return '&lt;delimiter&gt;'.join(messages)<BR>&nbsp;<BR>&nbsp;<BR><BR>het ultieme online mailprogramma! Ontdek Windows Live Hotmail, <A href="http://get.live.com/mail/overview" target=_blank>&lt;http://get.live.com/mail/overview&gt;</A> &nbsp;<BR>_________________________________________________<BR>Python.NET mailing list - PythonDotNet@python.org<BR><A href="http://mail.python.org/mailman/listinfo/pythondotnet" target=_blank>http://mail.python.org/mailman/listinfo/pythondotnet</A><BR><BR><BR>
<HR align=center width="100%" SIZE=1>
Now you can have a huge leap forward in email:<B> get the new Yahoo! Mail.</B> <A href="http://us.rd.yahoo.com/evt=40705/*http://mrd.mail.yahoo.com/try_beta?.intl=ca" target=_blank>&lt;http://us.rd.yahoo.com/evt=40705/*http://mrd.mail.yahoo.com/try_beta?.intl=ca&gt;</A> &nbsp;<BR></SPAN></FONT></BLOCKQUOTE><FONT face="Verdana, Helvetica, Arial"><SPAN style="FONT-SIZE: 12px"><BR>
<HR align=center width="100%" SIZE=3>
het ultieme online mailprogramma! Ontdek Windows Live Hotmail, <A href="http://get.live.com/mail/overview" target=_blank>&lt;http://get.live.com/mail/overview&gt;</A> <BR>
<HR align=center width="95%" SIZE=3>
</SPAN></FONT><FONT size=2><FONT face="Monaco, Courier New"><SPAN style="FONT-SIZE: 10px">_________________________________________________<BR>Python.NET mailing list - PythonDotNet@python.org<BR><A href="http://mail.python.org/mailman/listinfo/pythondotnet" target=_blank>http://mail.python.org/mailman/listinfo/pythondotnet</A><BR></SPAN></FONT></FONT></BLOCKQUOTE><FONT size=2><FONT face="Monaco, Courier New"><SPAN style="FONT-SIZE: 10px"><BR></SPAN></FONT></FONT></BLOCKQUOTE><br /><hr />het ultieme online mailprogramma! <a href='http://get.live.com/mail/overview' target='_new'>Ontdek Windows Live Hotmail,</a></body>
</html>