Posts Tagged “Exchange”

I recently switched to the Mac for my work computer (with Windows XP in parallels… I have some VBA macros that are necessary to do my job. Over time, I expect to replace most of it with AppleScript.)

The other day, I noticed some weird emails in my Sent Items Folder in Entourage. They did not have a sender or a subject. If I opened them up, I could see all the headers and any html tags(if any). under the displayed headers, I could see that it was indeed emails that I was sending, but they were somehow becoming corrupted. Today, I figured out that they were emails being sent with my iPhone using my exchange account. I did a little searching and found out that there is a bug that adds some junk to the email header. Outlook on the PC doesn’t get the bad headers because of the way it connects to the server or it just ignores the bad header (it wouldn’t suprise me if the latter was the case).

Fortunately, it is just a simple added three lines at the top of the email and this should be correctable with a script. Since I am trying to learn AppleScript anyway, I thought I would take my chances. After reading a view discussions and blog posts on the issue with some suggested fixes and scripts, I came across an AppleScript made to correct the problem that I decided to examine. Unfortunately, this script didn’t work at all for me, but from looking at the script, it appeared this was mainly due to how it was attempting to detect the “bad email”. Pretty much every “solution” I found required the user to select one or more messages in Entourage and running a script from the Entourage Script menu. Not a very elegant solution, in my opinion. On top of that, it appears that Entourage does not allow AppleScripts to directly modify the email and save it back anyway. Well, I need better detection, and the ability to link the script to an Entourage Rule (and maybe still maintain the ability to run it from the script menu if I wanted.) So, I did and here you go:

Download:

FixSentFromiPhone_1.2.scpt.zip

Here is how I setup my Rule in Entourage to make it run automatically when new message arrive in my sent items folder:
Execute If all criteria are met
If
Folder Is Sent Items
Specific Header Subject Does not exist
Then
Run AppleScript FixSentFromiPhone.scpt

UPDATE: I found that there is a much easier way to do a portion of the script I wrote and updated it.

UPDATE2: It appears my script needs to be made more flexible in order to handle messages with multiple recipients (at least it didn’t work correctly when I did a “reply to all”). I am thinking about it and may update soon.

UPDATE3: Since I had not gotten around to it yet, a reader modified my script and sent me the changes he made to handle messages that had been sent to multiple destinations. I then took his changes and integrated them into the script. Everything seems to work well for me. The download above has been updated. Thanks!

Tags: , , , , , , ,

Comments 10 Comments »