I have an application that automates email communications between my companies service desk and customers.
When the application needs to reply to an existing email, i use FindItems to get the email and then i load the properties i need, then i use (CreateReply) to get the response email i need to send.
The strange behavior is as follows:
The email i need to reply to has a correct SentDateTime and timezone (+4 GMT) but when i create a reply from it the sent date of the "replied to email" becomes UTC which makes no sense!
I am specifying the timezone when i am connecting to exchange correctly and i cant seem to find a way to specify the timezone of the created reply message.
I really hope someone knows anything about this.
Just to point out, when i use outlook to manually reply to emails, the replied to email sent date time is correct. The problem only happens when i use exchange web services.
Regards
Yazeed
This problem happens because the EWS Managed API omits sending the TimeZone headers in most requests. For the reply, forwards you do need send the timezone headers else it will set the header information to UTC. One workaround is to use the events to add the timezone header back in see http://blogs.msdn.com/b/emeamsgdev/archive/2014/04/23/ews-missing-soap-headers-when-using-the-ews-managed-api.aspx . The source for the EWS Managed API is also available now so you could also patch the GetTimeZoneRequired method and recompile the library https://github.com/OfficeDev/ews-managed-api/blob/31951f456519786e41232fa9ff6a3ab20b56cac3/Core/ServiceObjects/Items/Item.cs .
Cheers
Glen
Related
recently I ran into a problem where I was using python imap to automate outlook tasks, but microsft changed basic auth to Oauth now, and I have not being able to authenticate ever since, I get an error
imaplib.error: AUTHENTICATE failed.
So I started working with the Microsoft graph API, in which I can get the information that I need but once I need to forward an email I can't setup a custom subject, I can just add a comment and toRecepient custom arguments.
https://learn.microsoft.com/en-us/graph/api/message-forward?view=graph-rest-1.0&tabs=http
any advice here ?
If you use the Create-Forward endpoint https://learn.microsoft.com/en-us/graph/api/message-createforward that will create a draft message of the forward which you can then patch any message property you want to update and then send.
The one thing they don't mention in the documentation is you should set the Prefer: outlook.timezone header to make sure the dates in you response are set the local time of the responder.
My intranet web application (written in C#/ASP.Net MVC) sends email notifications in certain situations. I would like to intercept replies to such emails and perform actions based on the content of such replies.
I have no preference for scripting language - it could be Powershell, Python, VBA, anything - as long as I can parse the subject and body of the email, I can then alter the database of my web application through this script and pick up changes with an automated task, but I really have no clue where to start. I would be really grateful if someone could point me in the right direction.
QUESTION
How can I intercept emails sent to the Outlook server and perform action based on the content of such emails?
It sounds like you need an inbound email parsing service. I've worked with the one from SendGrid and it will catch any replies to a specific email address, and then post the email contents to an action on a controller in your MVC app. This will give you access to the full email contents and you can process it as needed.
See Setting up Inbound Parse
We are currently using Mandrill to send emails. We use mandrill quite a few different systems to send emails.
Is there any API way to get the content of a sent email? I Know mandrill stores a copy for up to 30 days.
At this time, there's not an API for the email contents. If you're using templates, you can use the templates/render API call to get the rendered HTML of a template with merge tags and the like, but it isn't the actual content of a sent email.
You can use the messages.content method, you just need the API key and the message ID (which is returned in the send call).
Bear in mind that Mandrill only saves the content for 24h by default, and it can be extended up to 30 days by paying. So make sure you make the messages.content call within that time frame.
Also, other people have had trouble when calling messages.content too soon, as it appears that the content takes a bit to be indexed (see answer in this post)
Our experiments have shown that GMail does not use UTC for the internal dates in its mailstore. Anyone know what offset it uses? We've narrowed it to between 3 and 7 hours behind UTC (exclusive), and we could figure it out with further experimentation, but maybe someone knows off-hand. UID SEARCH and the like aren't very accurate if you are assuming UTC and it's not the case. :-)
Further, we're wondering if it's consistent regardless of where you're connecting to gmail in the world.
Update: the first test showed UTC-4 or UTC-5, and a second test I did (sending hourly emails) revealed my account to be UTC-7. We're wondering if it's set when you register depending on your source IP (I also registered an account with a UTC-10 timezone and the internal store was still UTC-7. And changing your account timezone later doesn't change the internal store date an IMAP client sees, wisely, I would think).
I had written a python IMAP lib client and confirmed that the Gmail timezone is UTC-07:00 and I have confirmed it over and over again. So, any search results that you obtain (more precisely the after: startDate and before: endDate query) are shifted by that much amount according to your local timezone. This is because the mailstore uses the local time according to the sender SMTP server, which in case of gmail happens to be at UTC-07:00.
Right now my app sends out email notifications. I'd like to allow the user to reply directly to the email, which then gets ingested by my app and inserted into the database.
Are there any Rails gems, services, tutorials that can point me in the right direction.
Also, probably need to make the reply-to email have a UID, replyto--UID#domain.com, so I don't have to rely on the from (sender).
What do you think?
Thanks
A few good articles to get you started:
http://railstips.org/blog/archives/2008/10/27/using-gmail-with-imap-to-receive-email-in-rails/
http://jasonseifer.com/2009/04/24/receving-email-with-rails
We have a free service that posts incoming email to a url of your application (same as sendgrid API):
http://www.smtp2web.com
You can also use the mailman gem if you want to poll for the email at regular intervals:
https://github.com/titanous/mailman
As far as the 'replyto--UID#domain.com' kind of email addresses are concerned, you will have to create a catch-all address for your domain (it is better if you use a obscure subdomain, as it would reduce the amount of spam) which forwards all such email to a given mailbox(say notifications#domain.com).
I would highly recommend using CloudMailin for the same.
It provides you a receiving email address, which you can add as a reply-to header in your mail.
About the unique UID, for tracking each reply in context of the sent email, you could generate a random string, and modify your reply-to header as "[email provided by cloudmailin]+[your random string]"
You'd need to look at configuring your sendmail/postfix to accept incoming mail first off ( if you're using unix based server ).
Heres a good article:
http://jasonseifer.com/2009/04/24/receving-email-with-rails
You can use Sendgrid to parse incoming email and have it send along to your app via a web-post.
This is a decent tutorial (heroku focused)
Or you can view Sendgrid's ParseAPI to see how to integrate.