AppleScript works for everything except Exchange server emails

Here is the script:
using terms from application "Mail"
          set theRuleName to name of theRule
          on perform mail action with messages theMessages for rule theRule
                    tell application "Mail"
                              repeat with eachMessage in theMessages
                                        set theSender to extract name from (sender of eachMessage)
                                        say "Mail from " & theSender using "Alex"
                              end repeat
                    end tell
          end perform mail action with messages
end using terms from
It is called from a Mail rule. Here is the rule:
It works for every incoming message except for those that originate from an Exchange account.
Here is the interesting part: If I manually "apply rules" by selecting the message and using Option ⌘ L then it speaks the name perfectly. It is only when the mail arrives (by checking for new mail, for instance) that the script does not appear to do anything.
More interesting: The email does get its background color set to Blue. So as far as I can tell, the Rule is being executed, but the script isn't.
Here is the Rule for everything else:
(speakname5 is identical to speakname6 just without the voice "Alex" - here it is anyway)
using terms from application "Mail"
          set theRuleName to name of theRule
          on perform mail action with messages theMessages for rule theRule
                    tell application "Mail"
                              repeat with eachMessage in theMessages
                                        set theSender to extract name from (sender of eachMessage)
                                        say "Mail from " & theSender
                              end repeat
                    end tell
          end perform mail action with messages
end using terms from
If I try to simply use the same Rule for everything it still does not work for the Exchange email account. That is the reason for two separate scripts - it was a troubleshooting attempt.
Why does it only work when manually "applying Rules"?
Is there anything else I can include in the speakname6 script to indicate that it is actually being called?
Here are all my Rules, so that their order is known:

Here is my revised, simply awful, script:
using terms from application "Mail"
          on perform mail action with messages theMessages
                    tell application "Mail"
                              repeat with eachMessage in theMessages
                                        say "script entry"
                                        set AppleScript's text item delimiters to {""}
                                        set theSender to sender of eachMessage as string
                                        set brkpos to offset of "<" in theSender
                                        if (brkpos is greater than 1) then
                                                  say "break position is greater than one "
                                                  set theSender to (text items 1 through (brkpos - 1)) of theSender as string
                                                  if theSender contains "\"" then
                                                            say "the sender contains a quote "
                                                            set AppleScript's text item delimiters to {"\""}
                                                            set theSender to text item 2 of theSender as string
                                                  end if
                                        else
                                                  say "break position is less than or equal to one "
                                                  if (brkpos is equal to 1) then
                                                            say "break position is equal to one "
                                                            set theSender to (text items 2 through -1) of theSender as string
                                                  end if
                                                  set AppleScript's text item delimiters to {"@"}
                                                  set theSender to text item 1 of theSender as string
                                        end if
                                        say "end break position test  "
                                        say "Mail from " & theSender
                                        say "script exit"
                              end repeat
                    end tell
          end perform mail action with messages
end using terms from
The result of all this is the same... a tortured way to extract the sender's name, which works but the results are exactly the same as the other one.
When an Exchange email arrives, the above script speaks "script entry" and that is the last I hear from it. All other emails speak the sender's name just fine. As before, manually "applying rules" after the email is received speaks the sender's name as I would expect.
So it is getting lost prior to "end break position test" but I have no idea why.

Similar Messages

  • My apple TV works for everything except hulu and netflix.  they worked but have suddenly stopped and I can not enter them

    my apple TV works for everything except Hulu an Netfix.  When I try to open them I always get the message that they are not available and to try again later

    Update software. If that doesn't work try resetting.  Mine started working after the update.

  • AirPlay works for everything except Stan.

    airplay works for everything from the iPad, youtube, iTunes etc. no drop outs, clear as day. When using Stan it connects and streams for about a minute, then the air play connection drops out. Re connects but at best plays for a minute. Router in next room. Internet speed seems fine. Stan plays movie content with no issue from ipad and mac book air.
    any help greatly appreciated. Have updated Apple TV, reset router. Reset devices. Still no joy

    Thanks for getting back to me. In the end we had Telstra upgrade the router and cable service to 3.0. Works a treat now.

  • The itunes store works for everything except apps, how do I fix this??

    the itunes store works for books, music etc but NOT apps - how do I fix this?  I downloaded the latest version and that did not help.

    You have posted in the mac Apps Store forum, which is entirelt different than the itunes store adn teh apps store from within the itunes store.
    Are you looking for apps for your computer ( he Mac app store) or apps for your ipod/iphone/ipad ( itunes app store)?

  • Can't eprint from exchange server email address

    I am unable to eprint from my exchange server email address and I can print from other accounts such as @att.net aacounts.  This problem has started in the last week.  I have reinstalled the printer and varified the allowed address.
    Any ideas?

    Hi Rick60422,
    Welcome to the HP Support forums.  I gather that in the last week or so you have been unable to print emails from your exchanger server email address.
    I have included a document here that has trouble shooting steps to take when an ePrint job fails.   
    Regards,
    Happytohelp01
    Please click on the Thumbs Up on the right to say “Thanks” for helping!
    Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
    I work on behalf of HP

  • Delay downloading Exchange server email

    I use an iMac with an ethernet link to cable internet service. Using Mail, I have a strange delay of 1-2 minutes before email downloads from an Exchange server. Interestingly, my MacBook, also using Mail, downloads the same Exchange server email almost instantly using an Airport Extreme with the same cable modem providing the cable signal.
    In fact, I just switched from a 2007 iMac to a 2010 iMac, used Migration Assistant to transfer everything from the 2007 to the 2010 iMac, and I have the same delay of about 1-2 minutes before email downloads from the Exchange server.
    The email always downloads--it's the delay on the iMac that's puzzling.

    It's hard to say based on what you posted.  I would guess that the VPN connection doesn't provide the complete name resolution you get when connected to the network internally.
    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."

  • I have all of my music on my dad's apple ID (on my Macbook pro and iphone). I want to start using my own apple ID (the one that my iPhone uses for everything except iTunes store) as my iTunes apple ID - how do I do this without losing my old music?

    I have all of my music on my dad's apple ID (on my Macbook pro and iphone). I want to start using my own apple ID (the one that my iPhone uses for everything except iTunes store) as my iTunes apple ID - how do I do this without losing my old music?

    Authorize your computer with your Dad's AppleID.

  • ODI 11g 11.1.1.7 with Win64 bit OS : Starange problem : Right click does not work for Create new data server in Topology.

    ODI 11g 11.1.1.7 with Win64 bit OS : Strange problem : Right click does not work for Create new data server in Topology.
    On right click nothing happens at all. I have  reinstall the ODI multiple times with right installer. issue persist.
    Please help.

    Hi,
    Did you use the generic installer or the win32 one ? You should use the former with Win64.
    You can also check that your version of Java is supported in the certification matrix.
    Regards,
    JeromeFr

  • ITunes won't download to my laptop, its an MSI and has windows 7. It works for everything but iTunes fails to download, help please

    iTunes wont download to my laptop,its an MSI and has windows 7, its works for everything else. Please help

    Do you get an error message when you try to download iTunes? If so, what does it say? (Precise text, please.)

  • TS1398 I have recently updated my software to iOS 7. I have made an Apple ID which works for everything else but imessage and FaceTime. Why is this happening? What can I do to resolve this issue?

    I have recently updated my ipad mini to iOS 7. My Apple ID works for everything apart from iMessage and FaceTime. When I sign in, it says check your network connectivity and try agin. I have tried several times. Why is this happening? What can I do to resolve this issue?

    I am having this problem.  At first with the new iPhone 5, and then with the iPad 2.  I am not sure why this is happening. 
    My gut feeling is this is an iO6 issue and here's why -
    The problem mainly occurs with apps.  I have about 150 apps, and when I plugged in the phone, iTunes went to sync all of them.  The process would hang up after about 20 - 30 apps were loaded onto the phone. I could tell where about the process hung up because the apps on the phone showed up as "waiting".
    Then on the iPad 2 I plugged in to sync and saw there was a huge "Other" component in my storage.  It required me to restore the iPad 2 from backup.  With this restore the same issues occurred - putting the apps back on the iPad would hang up.  The videos on the iPad also got stuck - maybe after about 10 hours of videos transfered iTunes crashed.
    My solution has been to soft reset the device, restart Windows, and continue the process until it's complete.  This is remarkably inefficient and time-intensive but everything works with patience.
    I have been wondering if others have had these same problems. 

  • I am using iPad1. Running v4.3 and when connecting to wifi iPad keyboard does not work. Keyboard works for everything else including typing this question out. Why would it not work when typingin password for wifi connection?

    I am using iPad1. Running v4.3 and when connecting to wifi iPad keyboard does not work. Keyboard works for everything else including typing this question out. Why would it not work when typingin password for wifi connection?

    Kowhai wrote:
    Lots of WIFI needs a username and password to get access. I guess you're lucky and yours is set up unsecured.
    Normal secured WiFi requires only a password to get access. The password is used to encrypt traffic between your device and the WiFi access point. If whatever you are using requires a username as well then it is not simply normal secured WiFi. It might be a subscription WiFi service like GOGO, ATT, etc., or a service with authentication, i.e., college campus, etc. To help you out we need to know what you are using and what connection dialog you are being presented with. You don't have exactly the same problem as the original poster. He is having a problem entering a password into the password dialog that iOS presents when one tries to connect to a normal secured WiFi network. Could you clarify exactly which WiFi service you are using.

  • HT1766 no sound from my speaker, headphones play normal, phone rings normal, alarm sound normal, re-installed software, will not play sound when music is played from speaker but speaker works for everything else....

    No sound from my speaker iphone 4S, headphones play normal, phone rings normal, alarm sound normal, re-installed software, will not play sound when music is played from speaker but speaker works for everything else....(phone ring and alarm)... no notification sound for text messages......
    I checked all settings..... good...
    confused???
    please advise,

    it's a hardware issue read more about it here
    https://discussions.apple.com/thread/1343532?start=315&tstart=0
    more hits
    https://www.google.dk/search?client=opera&q=4:3&sourceid=opera&ie=utf-8&oe=utf-8 &channel=suggest#client=opera&hs=UGk&channel=suggest&sclient=psy-ab&q=iphone+stu ck+in+headphone+mode&oq=iphone+stuc&gs_l=serp.3.3.0l4.412779.418971.0.420896.16. 9.2.5.5.0.86.545.9.9.0...0.0...1c.1.9.psy-ab.HHtp6aEcO5U&pbx=1&bav=on.2,or.r_cp. r_qf.&bvm=bv.45175338,d.bGE&fp=43d9a4347e8aaeda&biw=1535&bih=773

  • High Availability for Existing Single Exchange Server holding Multiple Domains

    Hi,
    I'm trying to implement solution for Backup/Redundancy/High-availability for the existing Exchange Server 2013.
    Currently the Exchange Server 2013 deployed on 2012 Server is holding 4 Domains (1 internal domain  & 3 public/published domains). The Exchange Server is hosted Internally & published to send & receive mails from the SMTP relay(Third party
    resides on internet) server. Client Access & Mailbox Services are on the same server.
    Please advice me which is the best scenario to implement a backup/redundancy/high-availability for the current server.
    Thanks in advance.
    Regards
    Roopesh S

    Hi,
    The following links will help.
    High Availability and Site Resilience
    http://technet.microsoft.com/en-us/library/dd638137(v=exchg.150).aspx
    Deploying High Availability and Site Resilience
    http://technet.microsoft.com/en-us/library/dd638129(v=exchg.150).aspx
    Planning for High Availability and Site Resilience
    http://technet.microsoft.com/en-us/library/dd638104(v=exchg.150).aspx
    Backup, Restore, and Disaster Recovery
    http://technet.microsoft.com/en-us/library/dd876874(v=exchg.150).aspx
    ecsword

  • HT201401 i phone 4 - speakers work for everything but music.  Music works through headset.  Help

    i phone 4 - speakers work for everything but music.  Music works through headset.  Help

    Do you just go around copying and pasting that on to everyone's posts?
    This is quite clearly the same issue that quite a few of us are having with the software. Please update us on the progress of fixing this rather than unhelpful posts.
    IOS 5.1.1. update bug (Volume Control)

  • Turn off icon preview for everything except pix?

    I.m.o. it was a step backward in Leopard that icon previews were also made for text documents. This is nonsense. I have to see at the first glimpse what a Pages document is and what's an RTF; it's absurd to show the text preview in an icon! You can't recognize the content of a text document in 48X48, 0,01p size!
    I can only turn the previews on / off for all kinds of files. But then I can't recognize pix either, which is annoying.
    At the moment, I have made all extension visible, but reading an extension is not as fast as seeing a file's icon.
    *Does anyone know an app, hack or anything to turn previews off for everything except pictures?*
    Thank you very much
    Peter

    Baltwo,
    Thanks for trying to help me out.
    To give you some more detail:
    If, for example, in Excel 2004 I do CMD-O, then a window pops up to open a file. Top left of that window I can select the view mode for that window (3 possibilities). Now, if it is ´list´or ´columns´ view I indeed only see generic icons. However, if I select ´icons´ view (leftmost possibility of the 3), I see all icons change into previews. This despite the fact that in finder I disabled icon preview for all view modes (including ´icon´ view).
    Problem is the same in any application when opening files in ´icon´ view mode. A bit annoying.
    Thanks,
    HansC

Maybe you are looking for

  • Plant maintenance

    Hi Guys I need help whether we can achieve this functionality or not. The client creates Asset PO with non valuated material. For each and every PO we create a new asset master data. And at the time of GR we give the serial number. Now the client wan

  • Error 'Inconsistent datatypes' with Java classes

    Hi, I have some Java classes loaded in Oracle 8.1.6, mapped as Object Types, so when I create one object from PL/SQL, JVM ought to create the matching Java object, communicating via the SQLData interface. Unfortunately, after the code: pippo:=OraMail

  • Re-installing OSX Lion on a new hard drive

    I'm thinking about replacing my 320 GB hard drive. I just bought my mac a couple of weeks ago. I noticed that Apple recently upgraded their line of macbook pro computers. Since I want to replace my hard drive with a new one. I was wondering if I real

  • Daylight Savings Issue [Melbourne, Aust] on iPhone 6Plus

    Has anyone had issues with your clock not changing for daylight savings [Melbourne, Aust] on your iPhone 6Plus? I am running on IOS 8.0.2 - daylight savings came into effect Sunday morning, Oct 5 - my Date & Time is set to Auto. When I checked it was

  • Registering Informatica service in DAC client Fails

    Hi we are configuring BI-application with Oracle11.5.10. we are successful in installing all the components. But we are stuck in registering Informatica service in DAC client (section 4.12.2 in install guide) we gave the setting details as below Name