Results 1 to 9 of 9

Thread: [Outlook 2003] Email automation

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    16

    [Outlook 2003] Email automation

    Good day all,

    I am a little unsure how to word this so I apologize in advance if it comes out a little confusing. I have a question and if the answer to this is no then I think proceeding with this will be very tough.

    Question: Can a program/script/macro be actively running on a computer with MS Outlook open and trigger upon receipt of an email from a target email address?

    Programming: Basically, here are the steps I want to go through if the above question can be answered with a yes:

    1. email trigger received
    2. open all unopened items currently in "Inbox"
    3. parse through all unopened email items and concatenate them in a word/text/rtf document.
    4. create reply email to the trigger
    5. attach newly created document to this email
    6. send email

    It seems pretty basic, but seeing as how I am newly graduated and trying to think of some projects for myself to learn with I am having a bit of a hard time wrapping my mind around this.

    Again, I apologize if this has been poorly presented. I appreciate anyones suggestions, comments and criticism of the idea.

    Thanks,

    Trent

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: [Outlook 2003] Email automation

    (I think) Everything up to step 6 can be done automatically.

    Step 6 however will ask for user to click ok to send for each email created.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    16

    Re: [Outlook 2003] Email automation

    Really? Now, I have some things running here at work that trigger emails all the time that do not require user interaction, is this something that is specific to using outlook?

    I really appreciate the response!

    Trent

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [Outlook 2003] Email automation

    Everything can be automated but the Send part as it a security restriction to protect users from virus and such doing spam nodes from your system etc.
    See these two links for more.

    http://vbforums.com/showthread.php?t=402083
    http://vbforums.com/showthread.php?t=402086
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5
    New Member
    Join Date
    Feb 2008
    Posts
    3

    Re: [Outlook 2003] Email automation

    Im also facing the same issue of Security prompt when i try to send mail via outlook 2003 .i have donwloaded a freeware Express Click Yes it solves the problem but can anyone provide sample code which can do the similar thing



    Thanks In advance

  6. #6
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    413

    Re: [Outlook 2003] Email automation

    A better way to do this is to use Outlook Redemption. It allows you to send e-mails without the need to click yes when using Outlook. I have some basic code at work if you need a quick example.
    Visual Studio .NET 2005/.NET Framework 2.0

  7. #7
    New Member
    Join Date
    Feb 2008
    Posts
    3

    Re: [Outlook 2003] Email automation

    Hii


    Thanks for your quick reply.Yes plz share the code you are using.I dont want to use any paid thing cuz i want to use it for my project.Before using

    OutlookMail.Send method i was using SendKeys to send the mail but it fails when the system is in locked state.Is there any small code which i can add to my vbs script which can click yes on security popup.

    Please share the code you are using


    Thanks

  8. #8
    New Member
    Join Date
    Feb 2008
    Posts
    3

    Re: [Outlook 2003] Email automation

    i found this code but its not working


    Set fso = CreateObject("WScript.Shell")


    While fso.AppActivate("Microsoft Outlook") = TRUE
    wscript.sleep 1000
    Wend

    fso.SendKeys "a", True
    fso.SendKeys "y", True

    wscript.sleep 7000

    While fso.AppActivate ("Microsoft Outlook") = TRUE
    wscript.sleep 1000
    Wend

    fso.SendKeys "y", True

  9. #9
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    413

    Re: [Outlook 2003] Email automation

    You don't have to pay for redemtion as long as you don't sell it with your app.

    Here is my code.

    VB Code:
    1. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    2.         Dim objApp As Microsoft.Office.Interop.Outlook.Application
    3.         Dim objNS As Microsoft.Office.Interop.Outlook.NameSpace
    4.         Dim objSafeItem As Redemption.SafeMailItem
    5.         Dim objMailItem As Microsoft.Office.Interop.Outlook.MailItem
    6.         objApp = New Outlook.Application
    7.         objNS = objApp.GetNamespace("MAPI")
    8.         objNS.Logon("Outlook", "", False, False)
    9.         objMailItem = objApp.CreateItem(OlItemType.olMailItem)
    10.  
    11.         'objMailItem.To = "[email protected]"
    12.         objSafeItem = New SafeMailItem
    13.         objSafeItem.Item = objMailItem
    14.         'objSafeItem.
    15.         objSafeItem.Recipients.Add("[email protected]")
    16.         objSafeItem.Subject = "TestMessage"
    17.         objSafeItem.Body = "TestMessage"
    18.         'objMailItem.RTFBody = "TestMessage rtf"
    19.         objSafeItem.Attachments.Add("c:\17680.pdf")
    20.         'objMailItem.PrintOut()
    21.  
    22.         objSafeItem.Send()
    23.         'objSafeItem.
    24.         objSafeItem = Nothing
    25.         objMailItem = Nothing
    26.         objNS.Logoff()
    27.         objNS = Nothing
    28.         objApp.Quit()
    29.         objApp = Nothing
    30.     End Sub
    Visual Studio .NET 2005/.NET Framework 2.0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width