views:

350

answers:

4

Hello,

I'm working on an order entry application targeted to windows mobile devices.

I need to be able to send and receive emails from within the application, but without using pocket outlook (this is a customer requirement).

I see that the .net mail classes are not available for the compact framework. So I need to look elsewhere.

I found 2 interesting libraries: CSLMail and MooseWorks' Email Controls. But none is able to deal with SSL connections, and this is a mandatory requirement

I've found a few commercial email component suites supporting the compact framework, but their price is very high ($200+).

I guess I'm not the only one having the problem of sending and receiving emails - so, my question is: can anyone suggest me any free or low cost cf.net smtp/pop3 library?

Thanks

+1  A: 

First, I'll say that when you look at the cost of your time, $200 is a whole lot cheaper than writing it yourself, and it's a small price to pay for something that is done and tested.

On the free side, there is the Smart Device Framework, which contains the OpenNETCF.Net.Mail namespace, which does do SMTP. Still, you're on your own for SSL.

ctacke
It's true that buying a library costs far less than writing it from scratch - the problem is that my customer doesn't want to spend more money, nor I do on his behalf.Also, I think that $200 or more for a smtp/pop3 library is exaggerated, but this is my personal opinion, and we're not here to criticize sellers and their work.I already looked at opennet, but as you said it provides smtp only, and without ssl.
Antonio
A: 

Well, I think ctacke said everything there is to say.....however:

What regards SSL, there is a free component that works on Windows Mobile (and CF.Net) which is called SocketPro (written by Udaparts). You may find further information on this page (from where you can also download it). Have a look also at their forum where you can find examples.

I have successfully used this library in a small application of mine connecting to mail-servers that require SSL. The only exception is GMail which for some strange reasons the SocketPro-library has difficulties to communicate with. However, for GMail I used a version of OpenSSL which I found floating around on the internet which works well with GMail and CF.Net although it is a bit big in size.

Once you have established a connection with your mail-server, you can use ordinary POP3 for retrieving e-mails and SMTP for sending them.

Edit: I should mention that if your e-mails have attachments, then you need to look into MIME as well but that's another story. However, there are free libraries with source-code which can be found on the internet (try CodeProject).

Hope it helps...

moster67
Yes, my emails do have attachments (that's the reason why are sent by the application :)), and it must also work with GMail.so it looks like I have 2 choices:- force the customer to use pocket outlook- force the customer to buy a library
Antonio
A: 

OpenNetCF is definitively worth checking. As for commercial components - $200 for the tested and supported code would be probably cheaper than trying to roll out your own implementation or than trying to use some downloaded proof-of-concept code in production environment. Sometimes it's nice to have someone who is paid for solving your problems, anyway.

If you start evaluating commercial components you can try to check our Rebex Secure POP3 as well. It does support both SMTP/SSL, POP3/SSL and S/MIME on .NET Compact Framework. It costs a bit more that $200, though.

Martin Vobr
A: 

moster67 do you have any code sample, that you can provide me, to send email from Gmail?

I have the following:

USocketClass m_ClientSocket; m_ClientSocket.Send(Encoding.UTF8.GetBytes("EHLO smtp.gmail.com \r\n"));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("AUTH LOGIN"));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("\r\n"));

m_ClientSocket.Send(Encoding.UTF8.GetBytes(EncodeTo64(myUser)));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("\r\n"));

m_ClientSocket.Send(Encoding.UTF8.GetBytes(EncodeTo64(myPass))); m_ClientSocket.Send(Encoding.UTF8.GetBytes("\r\n"));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("MAIL FROM: "));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("\r\n"));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("RCPT TO: "));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("\r\n"));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("DATA"));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("\r\n"));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("From: "));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("To: "));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("Subject: Test subject"));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("My body test"));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("."));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("\r\n"));

m_ClientSocket.Send(Encoding.UTF8.GetBytes("QUIT"));

however it doesn't work, only works a few times!

can you help me?

Thanks.

Andrew

Andrew
Don't send messages to a specific person. This is not a newsgroup (though it would be bad etiquette there too). If you have a question (which it sure looks like you do), click the big ole "Ask Question" button in the upper right of your Window. Do *not* click "Post Your Answer" if you aren't providing an actual answer.
ctacke

related questions