Exactly one year ago I was watching the parade in the main road in downtown Dublin Ireland. Oh how I miss Ireland, however this year holds new adventures. We're leaving for Japan in less than a month and I'm psyched! I can't really speak any Japanese but thank goodness two of my travel-mates can :)
The new duplex is GREAT! We're really enjoying it, it's so spacious and nice but it does seem a little silly to just be paying rent every month when we could be buying a house. The only complaint I have is the yard is full of sand burs (stickers) and people tend to track them into the house. We purchased some weed killer and seed to try and get rid of them, but from what I understand it's a long process. Ah the joys of having a yard!
I'm excited next week I'm going down to Dallas to visit one of my best friends. We're going to a Dallas Stars game (hockey) on Saturday night and Sunday we're driving to Austin for a TXRD bout! She's also getting me some Sprinkles cupcakes for my birthday. I <3 Sprinkles cupcakes.
Happy St. Patrick's Day! Find a shamrock and drink green beer!
V
Tuesday, March 17, 2009
Monday, March 9, 2009
Extended MAPI Implementation
Howdy! Welcome to yet another programming post. I have spent an entire week figuring out the extended MAPI API and implementing my own class to send emails with attachments. This is pretty old school, since these days you can simply use the SMTP built in functions in C#, but as always, I don't have that luxury. I'm working in Visual Studio 6 MFC.
I found several different implementations and learned alot from each one, but there was one I benefited more from than the others. This wrapper is called TI_MAPI. I was able to look at the source code and figure out what the heck is going on and how to get what I needed to send a message.
First off, you must call MAPILogonEx which will give you a valid session pointer (assuming the call succeeds). You can then use this session pointer to access other objects and interfaces as needed for sending an email message. For example, I used the session pointer to retrieve my Outbox folder from which I created a new message, recipient, attachment, ect. It is really a whole chain of objects you must create/retrieve to get to the next one. I will not detail my wrapper class but give you helpful links so if you run into the same task I did, you will have many sources at your disposal. Oh, one thing to keep in mind when Googling this, there is also a "mobile" version of MAPI. Be sure to check the top of the MSDN page before reading, as the mobile version is different than the "outlook" version.
Lastly, pay very close attention to which flags are getting set. There are properties for each message, recipient, and attachment as you will see in the source code linked below. The flags are very important and those used in the source code may not be exactly what you need for your project. Each function (in MSDN, see links below) will list available flags and you can search on these to get more information.
TI_MAPI
If you're sending an attachment, and the recipient keeps getting a "winmail.dat" file instead, try this approach: SGriffin's Forcing Plain Text
MAPILogonEx
IAddrBook
IMAPISession
IMessage
This is a list of numeric error and success codes that may be returned from extended MAPI. They are different from simple MAPI.
That should be enough to get you started. I would have loved to have this list and source code from the beginning! Happy coding!
V
I found several different implementations and learned alot from each one, but there was one I benefited more from than the others. This wrapper is called TI_MAPI. I was able to look at the source code and figure out what the heck is going on and how to get what I needed to send a message.
First off, you must call MAPILogonEx which will give you a valid session pointer (assuming the call succeeds). You can then use this session pointer to access other objects and interfaces as needed for sending an email message. For example, I used the session pointer to retrieve my Outbox folder from which I created a new message, recipient, attachment, ect. It is really a whole chain of objects you must create/retrieve to get to the next one. I will not detail my wrapper class but give you helpful links so if you run into the same task I did, you will have many sources at your disposal. Oh, one thing to keep in mind when Googling this, there is also a "mobile" version of MAPI. Be sure to check the top of the MSDN page before reading, as the mobile version is different than the "outlook" version.
Lastly, pay very close attention to which flags are getting set. There are properties for each message, recipient, and attachment as you will see in the source code linked below. The flags are very important and those used in the source code may not be exactly what you need for your project. Each function (in MSDN, see links below) will list available flags and you can search on these to get more information.
TI_MAPI
If you're sending an attachment, and the recipient keeps getting a "winmail.dat" file instead, try this approach: SGriffin's Forcing Plain Text
MAPILogonEx
IAddrBook
IMAPISession
IMessage
This is a list of numeric error and success codes that may be returned from extended MAPI. They are different from simple MAPI.
That should be enough to get you started. I would have loved to have this list and source code from the beginning! Happy coding!
V
Subscribe to:
Posts (Atom)
