I am using the excellent example at CodeProject to read .MSG files however many are coming back with no body text. I have stepped into the code and I believe this is because the property key __substg1.0_1000 of the Outlook message does not exist (GetMapiPropertyFromStreamOrStorage() method of Outlook Storage) in the message properties.
Do I need to look for an alternate property key to read the message body from these emails and if so what is it? Is there another way around this?
I'm not near a computer, well, I guess my phone is sort of a computer, but are you sure they're emails? Calendar and contact items generally won't have that property.
PidTagBody, PidTagHtmlBody, and PidTagRtfBody(?) are all properties that can contain body information. However, if there is an HTML or rtf body, you will almost always have PidTagBody property populated.
You can check the PidTagMessageClass property to determine if its an email, note, contact, etc. An email will have the value "IPM.Note". You'll have to look up the property ids for these names yourself, at least until I can get near a computer.
Related
I have a web page that uses a webmail service to send emails. This is on an company intranet using a Microsoft Exchange server. My website created an email with a link to an image handler on my website. In my code, I can print some debug messages and I see:
<img src='http://tav.target.com/VIBEHandler.ashx?id=z064441_45975&type=Amazing'/>
But in the email, when I view the source code, I see this:
<img src="http://tav.target.com/VIBEHandler.ashx?id=z064441_45975&type=Amazing"/>
My single quotes changed to double quotes (no big deal).
&
changed to
&
This causes the URL to not work and images appear as the red "x", indicating a missing image.
How can I preserve my URL?
Your 3rd party emailing service might be converting your HTML document to a valid XML document for compatibility reasons.
http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
Basically, in XML, an ampersand character represents and XML entity, and can not be used unless you place the text within a CDATA node. Your 3rd party service seems to just be converting the & to & , which would work to safely display the value, but doesn't do too much for a URL.
http://www.w3schools.com/xml/xml_cdata.asp
If I were in your situation, I would URL encode the image URL when generating the HTML document that is being sent out. This way, it is both a proper link, and a valid XML string.
HttpUtility.UrlEncode(myUrlString);
http://msdn.microsoft.com/en-us/library/4fkewx0t%28v=vs.110%29.aspx
Hope this helps!
The best solution we could come up with is to use a single variable with multiple values separated with an underscore. This eliminates the need for the '&' symbol entirely and makes everything happy and compatible.
The URL is basically a link to an image handler so we can include images in emails without the use of attachments, shared drives, etc. The image handler can also do things like merge images together to create a single image (WAY better than trying to overlap images in emails which almost NEVER works). I simply added some code to the image handler that can check for and dissect the "meta-variable" in my URL.
http://sample.com?var=ONE_TWO_THREE
http://sample.com?var1=ONE&var2=TWO&var3=THREE
The URL now looks more clean and can have as many variables as I want so long as I put everything in the exact correct order, read it all in using the same sequence, don't miss anything, and document everything well. I COULD go one step farther and specify what each variable means:
http://sample.com?var=first-Nicolai_last-Dutka_age-34_etc-foobar
But that just tells the whole world what all my variables mean! Hypothetically, I could do:
http://sample.com?var=24154#kja&nl897q45pjkh8&&^HJ435
Then it would be up to me to determine where the breaking points are to bust that up into the variables:
24151, kja*, n1897, 45, etc
Of course, I'm not going to be that complex and will likely just stick to:
http://sample.com?var=ONE_TWO_THREE
Enjoy!
I have a Win Form application that does some boring accounting stuff and then sends it's data to some lucky recipients. I am using the Outlook 12.0 Interop objects and my applications environment ranges from office 2003 on XP to office 2007 on Win 7.
My issue lies with sending the corporate signature with the sent emails.
It contains two images and I would like to embed these images so they appear to be part of the body (assuming the receiving mail client supports that).
I have tried a few different methods of accomplishing this; but still no luck!
I have tried:
Extracting the html data from the signatures folder, changing the
html img tags src attribute to include 'file///'. This causes Outlook
to replace the 'file///' with 'CID' and I assumed it would also embed
the image... we should never assume :|. This is the method I found
worked best for getting the rest of the signature.
(After creating a new MailItem) - Grabbing the HTMLBody of the MailItem
and extracting the relevant part including the signature... This
didnt work due to the new MailItem object being very inconsistent
with it's signature. By that I mean sometimes the new item would
include the signature and sometimes it wouldn't! :s I cannot figure out why it is not always there, no other part of my code has changed!
I read on another post here about the GetInspector property... Apparently just calling this will do 'Some stuff' and the signature will magically appear in your mail item... NO!
Things I can't do:
I cannot (as much as i would like to) shove the images online
somewhere and point to them in the emails html.
I cannot use SMTP(It has to be through Outlook... sigh).
I am thinking that the best way seems to be my original method of messing about with the CID, but I do not really know much about what Outlook is doing in the background so I am having trouble figuring out what else I need to do to get the images sent along with the email.
Hoping someone out there has some idea about what I am doing wrong or what else I could try.
Please let me know if code would be helpful and I will post, (Most of the code tried is from this site... I just cannot find the links again and am trying to avoid making this question tooooo long).
Many thanks
This is not the most efficient or flexible solution you can use, but probably the most robust and portable. You can convert your image bitmap into plain HTML and embed that HTML in your e-mail signature.
The conversion is quite simple, you can use the utility I wrote (open source) here.
I'm adding an img tracking pixel to items that have embedded content using my outlook addin which allows me to track when the person has open the email (pretty standard practice)
I do this by adding an image tag right before the closing body tag upon the send event.
The problem is, outlook then calls the url three times (twice with a method of "OPTIONS" and once with "GET"), this defeats the whole purpose of the tracking pixel because it triggers the event on send.
Does anyone know why outlook makes these requests, or how to get around this?
I see two possibilities:
Either Outlook or Exchange Server is checking the eMail content before sending it
OR
Outlook is configured to “When an HTML message contains pictures located on the Internet, send a copy of the pictures instead of the reference to their location” - for changing that setting in Outlook 2007/2010 via Registry see http://www.msoutlook.info/question/72
BTW: the two OPTIONS calls let me believe that Outlook is somehow checking the server of the linked image for WebDAV and/or Frontpage extensions...
I am looking for a solution to the following problem:
My manager wants to automatically send a second message when he sends an email to X and there is no response in two days. If there is no further response in 2 more days, send another message.
Before I start building anything, I wonder if there is already a product/solution that does that? Can anybody recommend an already existing tool?
We use MS Exchange and he uses Outlook 2007.
Auto Follow Up is a tool I've used in the past for this specific purpose. Also, always check www.slipstick.com for listings of Outlook/Exchange add-ins - they seem to be the best source (disclaimer: I have no affiliation with that site or any of its add-ins)
It's not an existing solution, but in case you don't get any answers:
You can use Exchange Web Services to do this: pointing it at his Sent Items folder. So this is basically what you would do:
Use SyncFolderItems against his Sent Items, say every 1 hour. The first time you do this use null as the SyncState, thereafter use the last SyncState the server sent you.
Write them to a SQL table: { ItemId NVARCHAR(MAX), ChangeKey NVARCHAR(MAX), MessageID NVARCHAR(MAX), Sent DATETIME }. MessageID would be the Message-ID header from the message.
Run a query (say once a day) that selects the rows where the Sent value is more than 2 days ago.
Use GetItem to retrieve the original mail and resend (first clearing/deleting Message-ID) it using SendItem.
Delete the selected rows.
These items will land up in the Sent Items folder and will be picked up by your application (as they are actually new mails); and re-processed in 2 days.
Use SyncFolderItems against his Inbox, again maybe every hour (maybe immediately after the first operation against Sent Items). Keep a unique SyncState for this operation.
Grab the In-Reply-To header. Delete any rows with a maching MessageID.
Grab the References header; and split it into a list. Delete any rows with a matching MessageID.
Would this solve your problem:
http://www.followupthen.com/
Perhaps not exactly what you want and it isn't integrated into Outlook.
I don't think you will find exactly what you want. This is functionality which belongs to a CRM, not to email software.
Having said that, the Getting Things Done Outlook Add-In will get you in that direction. It won't automatically send a follow up mail, but it can take care of a notification so you send it yourself. (but this plugin is not free - $75 - you have to decide yourself if that's worth it)
With the GTD add-in you can send a mail, and select the option "Send and Action". After pressing send mail, you can select the action "#Waiting For", and press ok. Now it will create an outlook task, with the subject and contents of the email you sent automatically filled. You can set all the task properties, like end date and notification time.
After two days at the notification time, you get a (default) outlook popup, where you can open the task. With one click you can open the corresponding email and use reply or forward to send your followup. You can create a new task or modify the existing task for the next followup.
If you receive a reply in the mean time, and open the mail, you can use the "related task" button to find the corresponding task to mark it as complete. It also adds buttons like defer and delegate to your mail.
There is a 30-day trial. I am not connected to netcentrics, but I have bought and use this plugin.
Have you looked into automating Outlook using Visual Basic for Applications? If you aren't familiar with VBA, or if the thought of writing VBA gives you nightmares (I've had a few), then you might find some example VBA code on the web that accomplishes something similar to what you are trying to do, and then you could just tweak it. I know you said that you wanted an existing tool, but I thought I would throw this out there as a sort of last resort. It's not ideal, but I'm pretty sure it would solve your problem.
The problem:
Random e-mail from different clients are received in my MS Exchange mailbox, I am not concerned with previous content rather the latest text of the message and would like to extract it.
This is currently developed as C# managed Exchange sink obtain these messages but I cannot devise a straightforward method to reliably parse it or is parsing even the correct approach?
I also don't see any property tags that give me any direction to obtain the latest text either.
Any ideas?
Thanks