Lyteck Lynhiavu
asked on
How to modify an incoming email but keep it in the inbox (for further processing)
Hello: is it possible to modify an incoming email and leave it sitting in the inbox (the email account is being monitored by another application... which will pick up the email and do further processing)
- if the item contains attachment.
- code will append "--attachments--" to the subject
- code will append "--attachments--" to the body
The code below is a starting point... however, I think there is a problem in that the code forwards a copy rather than replace the current copy in the inbox (for downstream processing by the application monitoring the inbox). Thanks, Lyteck
- if the item contains attachment.
- code will append "--attachments--" to the subject
- code will append "--attachments--" to the body
The code below is a starting point... however, I think there is a problem in that the code forwards a copy rather than replace the current copy in the inbox (for downstream processing by the application monitoring the inbox). Thanks, Lyteck
Sub ForwardEmail(Item As Outlook.MailItem)
Dim olkForward As Outlook.MailItem, olkAttachment As Outlook.Attachment, strSubject As String, strRequester As String
Set olkForward = Application.CreateItem(olMailItem)
olkForward.HTMLBody = Item.HTMLBody
If Item.Attachments.count > 0 Then
olkForward.HTMLBody = olkForward.HTMLBody & "--attachments--"
End If
strSubject = Item.subject & "--attachments--"
strRequester = item.from 'IS THIS CORRECT SYNTAX TO COPY THE ORIGINAL SENDER?
olkForward.subject = strSubject
olkForward.Recipients.Add strRequester
olkForward.Recipients.ResolveAll
olkForward.Send
Set olkForward = Nothing
End Sub
ASKER
Yes,
- if email contains attachment, append text to subject and body
- if no attachment, leave email as is
In both cases the email sits in the inbox for further processing by other process.
Thanks Chris
- if email contains attachment, append text to subject and body
- if no attachment, leave email as is
In both cases the email sits in the inbox for further processing by other process.
Thanks Chris
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you Chris. Apologies for the long delay. Lyteck
Chris