Jump to content

ratjam

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by ratjam

  1. @Jos Line 75? The script I have has only 30 lines. Code is below. Thanks, ; Include Functions #include <OutlookEX.au3> Global $oForward, $sRecipient = "myemail@gmail.com" ; Connect to Outlook Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "Connect to Outlook", "Error connecting to Outlook. @error = " & @error & ", @extended = " & @extended) ; Access correct mailbox Global $aFolder = _OL_FolderAccess($oOutlook, "*\SW_Reqs_In", $olFolderInbox) If @error <> 0 Then Exit MsgBox(16, "Folder access", "Error accessing the mailbox. @error = " & @error & ", @extended = " & @extended) ; Get unread items Global $aItems = _OL_ItemFind($oOutlook, $aFolder[1], $olMail, "[UnRead]=True", "", "", "EntryID,Subject,Body") If @error <> 0 Then Exit MsgBox(16, "Item find", "Error searching for unread mail items. @error = " & @error & ", @extended = " & @extended) ; Forward all unread mails For $i = 1 To $aItems[0][0] $oForward = _OL_ItemForward($oOutlook, $aItems[$i][0], Default, "") ; Create a copy of the item to forward If @error <> 0 Then Exit MsgBox(16, "Item forward", "Error creating an item copy to forward. @error = " & @error & ", @extended = " & @extended) _OL_ItemRecipientAdd($oOutlook, $oForward, Default, $olTo, $sRecipient) ; Add recipient If @error <> 0 Then Exit MsgBox(16, "Recipient add", "Error adding a recipient to the mail item. @error = " & @error & ", @extended = " & @extended) _OL_ItemSend($oOutlook, $oForward) ; Send the item to the recipient If @error <> 0 Then Exit MsgBox(16, "Item send", "Error sending the mail item. @error = " & @error & ", @extended = " & @extended) _OL_ItemMove($oOutlook, $aItems[$i][0], Default, "*\SW_Reqs_Out") ; Move to OUT folder If @error <> 0 Then Exit MsgBox(16, "Item forward", "Error creating an item copy to forward. @error = " & @error & ", @extended = " & @extended) Next ; Close connection to Outlook _OL_Close($oOutlook)
  2. I copied a mail forwarding script from this forum and tweaked it to work with my account. I am forwarding emails that are in a specific folder populated by rules. It is working great, except for 1 issue. When the email gets forwarded, 2 emails are created in my outbox. One is the email being forwarded - which is successful. The other stays in the outbox and is blank. How can I avoid or automatically remove these dummy emails? Thank you,
×
×
  • Create New...