title: Programmatically reply to an email in Outlook
body: <p>I'm writing a script that replies to every email coming in. </p>
  
  <p>I have made a rule to run on all incoming messages that runs a script, sets the category, and marks as read. The rule sets the category and marks as read, but doesn't run the script. Below is my code: </p>
  
  <pre><code>Sub reply(Item As Outlook.MailItem)
  
      MsgBox "Hey this script is running!"
  
      On Error GoTo ErrorTrap
  
      Dim MsgReply As Outlook.MailItem
      Set MsgReply = Item.reply
      With MsgReply
          .Subject = "Welcome to IT Business Builder"
          .HTMLBody = "This is just a test"
          .Body = "This is just a test"
          .Send
      End With
      Set MsgReply = Nothing
  ErrorTrap:
      MsgBox Err.Number &amp; " " &amp; Err.Description &amp; " message not sent because of error"
  
  End Sub
  </code></pre>
  
  <p>After running the rule, no message box pops up, no emails are sent.</p>