Uisng ATL7 CMimeMessage classes
-
Has anyone here used CMimeMessage to compose or decode a MIME encoded message and attachments etc?
Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
PocketPC New menu Office addin -
Has anyone here used CMimeMessage to compose or decode a MIME encoded message and attachments etc?
Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
PocketPC New menu Office addin -
I want to use CMimeMessage and other ATL7 classes to create and decode MIME messages and attachments.For example, I want to create a MIME message with a single attachment like: IMultiLanguage *pLang = NULL; CoInitialize(NULL); CMimeMessage msg(pLang); if(msg.SetSender("visualcdev@hotmail.com")) if(msg.SetDisplayName("My custom mime message to be displayed in a string")) { msg.SetPriority(ATL_MIME_LOW_PRIORITY ); msg.SetSubject("custom subject"); msg.AddText(_T("hello world from a test message you should also end a string like this.")); msg.AddRecipient(_T("amitdey@softhome.net"),"amitdey@softhome.net",0); msg.AttachFile("C:\\scantastic.bmp"); } But when I view the contents of the message, by writing it to a file, the message is not a MIME formatted message( I cannot see the headers or anything. DWORD dwWritten; DWORD Ret = WriteFile(hFile,&msg,sizeof(msg),&dwWritten,NULL); message does not have proper MIME headers.How can I use CMimeMessage to create/modify MIME messages? Thanks.
Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
PocketPC New menu Office addin -
I want to use CMimeMessage and other ATL7 classes to create and decode MIME messages and attachments.For example, I want to create a MIME message with a single attachment like: IMultiLanguage *pLang = NULL; CoInitialize(NULL); CMimeMessage msg(pLang); if(msg.SetSender("visualcdev@hotmail.com")) if(msg.SetDisplayName("My custom mime message to be displayed in a string")) { msg.SetPriority(ATL_MIME_LOW_PRIORITY ); msg.SetSubject("custom subject"); msg.AddText(_T("hello world from a test message you should also end a string like this.")); msg.AddRecipient(_T("amitdey@softhome.net"),"amitdey@softhome.net",0); msg.AttachFile("C:\\scantastic.bmp"); } But when I view the contents of the message, by writing it to a file, the message is not a MIME formatted message( I cannot see the headers or anything. DWORD dwWritten; DWORD Ret = WriteFile(hFile,&msg,sizeof(msg),&dwWritten,NULL); message does not have proper MIME headers.How can I use CMimeMessage to create/modify MIME messages? Thanks.
Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
PocketPC New menu Office addinHi, the first part is OK and works. Your problem is in the
WriteFile
phase. You cannot use theWriteFile
as you did, because then you will just save theCMimeMessage
class as is in memory. And becauseCMimeMessage
nearly stores only pointers to other classes (body, attachements etc.) you'll see nothing usefull. The correct way how can you save the message is:msg.WriteData( hFile, &overlapped );
This method makes more processing, stores also the aggregated classes etc and makes a mime message for you. Hope this helps -
Hi, the first part is OK and works. Your problem is in the
WriteFile
phase. You cannot use theWriteFile
as you did, because then you will just save theCMimeMessage
class as is in memory. And becauseCMimeMessage
nearly stores only pointers to other classes (body, attachements etc.) you'll see nothing usefull. The correct way how can you save the message is:msg.WriteData( hFile, &overlapped );
This method makes more processing, stores also the aggregated classes etc and makes a mime message for you. Hope this helpsYes, the Overlapped i/o did it. Thanks. From the samples I have seen, CMimeMessage is more for composing and sending messages, what about translating/decoding messages and attachments.
Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
PocketPC New menu Office addin -
Yes, the Overlapped i/o did it. Thanks. From the samples I have seen, CMimeMessage is more for composing and sending messages, what about translating/decoding messages and attachments.
Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
PocketPC New menu Office addinAlso, if I have a mime-formatted message as an IStream, can I attach it anyway to a CMimeMessage and then use the classes to parse info? How? TIA.:)
Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
PocketPC New menu Office addin -
Also, if I have a mime-formatted message as an IStream, can I attach it anyway to a CMimeMessage and then use the classes to parse info? How? TIA.:)
Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
PocketPC New menu Office addin -
I don't think that the CMimeMessage is ready for parsing. It was designed for creating the message & sending. For parsing it will be required to use another class or build your own.
Interesting. I can see that the ATL7 CMimeMessage creates correct Outlook Express mail files. i.e. .eml format. Yes, I guess I would have to write a class myself. But it should not be too difficult, esp with all decoding code in the ATL classes that I can use.:-D
Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
PocketPC New menu Office addin