none
Send email crashes in 2013 Environment RRS feed

  • Question

  • I've been learning how to control different Office applications through visual basic scripts. For a little I had my script dealing with the Office 2010 suite but then I upgraded everything to 2013. Now my script is broken.

    At this point all I'm trying to do is automate sending an email to someone. I'm trying to use the Microsoft.Office.Interop interface to create an outlook email and send it. For some reason every time the mail tries to send it crashes with an E_ABORT error. I've been looking into this issue and I think it might have something to do with the security with outlook but it could be something else entirely.

    I've checked the settings in the trust center and various other settings and it seems to be alright but I must be missing something. This didn't happen in 2010 but now it seems to be a problem.  Does anyone know what could be causing this? Any helpful tips or articles would be greatly appreciated. Thanks in advanced! 

    Friday, December 4, 2015 3:03 PM

All replies

  • Hello Mike,

    > For some reason every time the mail tries to send it crashes with an E_ABORT error.

    What line of code exactly fires an exception? Did you try to debug the code?

    Anyway, it looks like you faced with a standard security prompt in Outlook. Sometimes instead of a dialog window you may get errors in the code. "Security" in this context refers to the so-called "object model guard" that triggers security prompts and blocks access to certain features in an effort to prevent malicious programs from harvesting email addresses from Outlook data and using Outlook to propagate viruses and spam. These prompts cannot simply be turned off, except in Outlook 2007 with an anti-virus application running.

    There are following workarounds for avoiding security prompts:

    1. Third-party components that allow to suppress such prompts.

    2. A low-level code (Extended MAPI) doesn't generate such issues. You may consider using any third-party wrapper around that API.

    3. Deploy Outlook security settings that "trust" certain COM add-ins or that allow all applications to have unrestricted access to certain features. Among the security settings that can be deployed is an option to trust particular add-ins. For example, add-ins can be trusted using Group Policy Objects or the Office Customization Tool.

    You can read more about possible ways in the Outlook "Object Model Guard" Security Issues for Developers article.

    Friday, December 4, 2015 4:19 PM
  • With Microsoft's Security Essentials installed and up to date, the following simple vb script successfully sent email through Outlook 2013 without errors or security prompts.

    '
    'Use Outlook to send email
    '
    set OL = Wscript.CreateObject("Outlook.Application")
    
    set m = OL.CreateItem(0)
    
    m.subject = "Test item"
    m.body = "Test Body"
    m.Recipients.Add("RLWA32@emailserver.com")
    m.Send
    

    Friday, December 4, 2015 5:36 PM
  • I did try to debug the code. The line that specifically caused the error was the mail.send() line. But I usually use mail.To = "email" to set the address. When I followed the example below with mail.Recipients.Add("email") then that line was the line the caused the error. It is probably my security after looking at the information you linked and your post. So once I figure out how to resolve that I'm sure it will work. Especially if @RLWA32 has a working method. 

    Friday, December 4, 2015 6:08 PM
  • Thanks for posting. It must be something on my end that is messing it up. I had a similar solution to yours and it was crashing for me. I will make sure my Security Essentials is correct. 
    Friday, December 4, 2015 6:09 PM
  • Hi Mike,

    What's the exact error message you got? I suggest that you display the message before you send the email and try to send it manually.

    If it also failed, I suggest that you try to repair the Outlook to see whether the issue was fixed.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 7, 2015 2:01 AM
    Moderator