问题
I'm currently tasked with adding limited email functionality to an application. It's only for Windows PCs that don't have Outlook installed but may have one of Outlook Express, Windows Live Mail, or something similar. I am not allowed to obtain email server details as the PCs are for clients, not internal. I also cannot use CDO or extended MAPI as the client may not have Exchange and I have also been forbidden from creating a web service to implement the functionality as that would be far too expensive to implement.
So naturally I looked into using a third party library but the best one I found, Redemption, as far as I can tell is out of the picture because it uses extended MAPI and only communicates with Exchange or Outlook.
A simple mailto link will not be sufficient because I have to include attachments.
Then I developed some .NET code based on this which mostly works but there are a couple of problems in that it only works without attachments unless an Outlook client is installed and that managed code is simply not compatible with MAPI in the long run. Typically it works fine on my main development machine but I have only managed to test on XP with Outlook Express and Vista with Windows Mail so far and attachments don't work in either of those.
I have been investigating further and have found that the only reliable solution appears to be writing a C++ or VB6 COM wrapper around the simple MAPI functions in MAPI32.dll. I'd rather not create a VB6 one, even though that would be the easiest solution for me and a C++ one is outside of my skillset and I'm dubious if it will work any better than the managed code I have used with all the OS and mail client scenarios involved.
How can I reliably implement email with attachment functionality under the above restrictions?
回答1:
We use a library by CodeStone which supports IMAP and POP and is pretty easy to implement.
http://codestone.co.uk/software/docs/csmail/csmail.html
来源:https://stackoverflow.com/questions/19678445/is-there-a-reliable-way-to-implement-email-functionality-without-an-email-client