One of the VO shortcomings is the possibility to send mail through GMail: SSL is required and the VO cSMTP classes cannot use SSL because the Windows API seems to not have the needed functionality.
Therefore I created a simple X# DLL, named SendMail.DLL that exposes a class interface ISmtpSender through COM and use this DLL in my VO applications.
You can find this DLL together with a VO sample application and the relative source code in XIDE export format attached to this message.
Of course you can enhance this DLL as needed, but please generate a new SNK file and new GUIDs for your own version. I'm using exactly this DLL in several of my applications.
The DLL must be located in the directory of the executable, otherwise SideBySide will not work.
The entire mechanism is a bit unstable until you understand how this works: it is a game between the COM interface of the DLL, the DLL manifest (generated by mt.exe) and the manifest of the executable. And please pay particular attention to the version info: they must match!
This is the content of the readme in the DLL source code:
Code: Select all
1) create key file with
sn - k sendmail.snk
2) after building and signing the DLL, read the public key with
sn -T sendmail.dll
(upper case T)
3) create the TLB with elevated rights
regasm sendmail.dll /tlb
4) remove the registration
regasm sendmail.dll /unregister
5) create the automation server in VO
6) add cClsID and cProdId in the Init method
7) create the manifest for the DLL
mt.exe -managedassemblyname:sendmail.dll -nodependency -out:sendmail.dll.manifest
8) adjust the manifest (remove "msil" and add "win32")
Caveats:
- the namespace should be set also in the DLL properties, can be identical to the DLL file name
- the class CANNOT have the same name as the DLL
Debugging (if the VO application does not starts):
sxstrace Trace -logfile:systrace.out
sxstrace Parse -logfile:systrace.out -outfile:sxstrace.txt
notepad sxstrace.txt
Wolfgang