Code to resend mail items

T

Tony Scholes

Hi

2nd attempt last post got semi-munched!

I've a need for a macro that will resend selected mail items to a specific
address without modifying the email body, subject or the sender.. Rather
like the "Resend This Message" button but without all the questions, and
something that I can use to resend (say) 20 messages at a time

So I have something like this :-

Sub SendToSpamTrap()
Dim objOL As Outlook.Application
Dim objMsg As Outlook.MailItem 'Object
Dim objMsgCopy As Outlook.MailItem
Dim objSelection As Outlook.Selection

Set objOL = CreateObject("Outlook.Application")
Set objSelection = objOL.ActiveExplorer.Selection

For Each objMsg In objSelection
If objMsg.Class = olMail Then
Set objMsgCopy = Application.CreateItem(0)
objMsgCopy.Body = objMsg.Body
objMsgCopy.To = "Spamtrap"
objMsgCopy.CC = ""
objMsgCopy.BCC = ""
objMsgCopy.SenderName = objMsg.SenderName
objMsgCopy.Subject = objMsg.Subject
If objMsg.GetInspector.EditorType = olEditorHTML Then
objMsgCopy.HTMLBody = objMsg.HTMLBody
Else
objMsgCopy.Body = objMsg.Body
End If
objMsgCopy.Send
End If
Next
End Sub

This I assign to a button on the task bar...

Anyway, I have 2 problems :-

1. I can't change the sender name, it always comes from me, and attempts
to modify the SenderName property fail since it's read only... I need it to
come from the original sender.
2. If the body isn't HTML then it always get's set to RTF (even if the
original is plain text) and you can't change it since the EditorType
property is readonly.

This is Outlook 2000, no Exchange server involved...

Any clues? All help appreciated...
 
M

Michael Bauer

Hi Tony,

you could add the original sender to the ReplyRecipients collection. And
instead of copying each property step by step just call
objMsgCopy = objMsg.Copy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top