Determine the latest content in an email - c#

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

Related

Outlook Storage Example not finding body text in .MSG

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.

how check a validated Email Exist Or Not Without Sending test Email by c# codes?

how can we check that a validated Email exist Or Not Without Sending test Email by c# codes?
we can check Validation of that email by many ways...
but what about existence?
is it possible to do that or not ?
thanks in advance
You should look at these websites. I've used a similar method to these three in the past when validating users emails for a federal website that required an authentic email address.
http://tools.email-checker.com/
http://verify-email.org/
http://www.technixupdate.com/check-whether-an-email-id-is-valid-or-not/
A mail server will usually quickly send back a response telling you if the email is valid or not, that is what you're going to be looking for.
As well, SO already has a few posts on this:
Checking if an email address exists
is one of them.
Update:
I love the existence tag...!
You could possibly use C# to run a cmd command - telnet. Then output the results to a text file and read them into to your C# app. This should help - http://www.webdigi.co.uk/blog/2009/how-to-check-if-an-email-address-exists-without-sending-an-email You will need to know the details for the mail server names though. You might be able to do this directly from C# but I have only done it through telnet.
I don't know if there's a good way to do what you're looking for, but a solution that might get you part of the way there is to ping the domain to at least make sure that exists.
Here's an MSDN link which explains how to ping from .NET:
http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx
You can use a Regex Validation on the form before the user submits the data. It's an inbuilt tool in Microsoft Visual Studio where you can pretty much drag and drop :)
You should be able to find it in the validation section . Regular expression Validator

Is there a way to automatically re-send an email according to certain rules with Outlook 2007 and MS Exchange?

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.

Reading email content

Hope someone may be able to help. What i am looking to do is create a small winform app in c# to read the content of a email from a pop account, and upload key values to a sql automatically. The email format is always the same for each email, eg,
First name :
Last name :
Phone number :
etc...
Currently the emails are being stored in a pop 3 account however i want a way to reduce having to key the information into the sql by hand.
Can anyone advise how i would go about doing this or could recommend some guides?
Thanks.
Steve
I would recommend using a class like this POP3 client at CodeProject to read the mail messages.
Once you have the message content, you should be able to fairly easily parse the string, since you know the exact format. There isn't enough information to recommend the best option for this - it depends on whether it's fixed format, delimited, separate lines, etc, but using regular expressions or even String.Split should make this fairly simple.
We use a purchased tool Email2Db tool to process incoming email. It is inexpensive and easy to configure. I wrote custom vb scripts for our needs but a simple insert into a db would not require any coding.

integrating two systems through email

I want to integrate our bug tracker system and our Support system through emails.
The bug tracker can kick out an email on every change to bugs/features. I want to download those emails, parse them and create a formatted email that the Support system can understand (ie the subject could be "Issue #4128 fixed").
What is the simplest way to accomplish this using C++ or C#?
Martin, I'd say there's no "simplest" way to do this. The easy part is downloading the e-mail. (If that's what you need help with, say so and I'll post some C# code that does this.) How you parse the e-mail depends on the format of the message.
For instance, if the body of the message contains the data you want to provide to your support system, your approach will be different than if that data is included as an attachment to the message.
With more information, I'm sure we can be more helpful.

Categories