Outlook Automation: Forward as attachment

G

Guest

My office is using MDaemon as our email server. It's spam reporter requires that the spam email be forwarded as an attachment. I created an Outlook 2000 macro to create a new mail item, attach the selected mail item to the new mail item, send the new mail item to "(e-mail address removed)" and delete the selected mail item

The only problem I have is that MDaemon sends me back a reply saying
"Incorrect Message Format"... "The message(s) you submitted to the spam or ham learning system were not accepted. You must submit these messages to MDaemon as attachments of type message/rfc822. When using Outlook Express use the 'Forward as attachment' feature.

Here is the code I have

'############# Outlook 2000 Spam Reporting Macro #################
' Select the Mail Item you want to report to spam and run this cod

Public Sub SendToSpam(
Dim objOL As Outlook.Applicatio
Dim objSelection As Outlook.Selectio
Dim objMsg As Objec
Dim objNewMsg As Objec

On Error Resume Nex

' Instantiate an Outlook Application objec
Set objOL = CreateObject("Outlook.Application"
' Get the collection of selected object
Set objSelection = objOL.ActiveExplorer.Selectio

' This code sends the selected mail item
For Each objMsg In objSelectio
' This code only sends mail item
If objMsg.Class = olMail The
' Create a new mail Ite
Set objNewMsg = Application.CreateItem(olMailItem
' send the new mail item to the spam reporting email addres
objNewMsg.To = "(e-mail address removed)
'save the new mail before adding attachments for consistenc
objNewMsg.Sav
' add selected mail item as attachment to new mail ite
objNewMsg.Attachments.Add objMs
' send the new mail ite
objNewMsg.Sen

' Clear the New Mail Item objec
Set objNewMsg = Nothin
' Delete the spam mail ite
objMsg.Delet
End I
Nex

ExitSub
Set objMsg = Nothin
Set objSelection = Nothin
Set objOL = Nothin
End Su

'############# End of Outlook 2000 Spam Reporting Macro ##########

I have searched for five days to find a way to make this work (I'm usually quite proficient at finding things I am looking for)... any help would be appreciated!


I want to point out that the new mail item that is created with Automation looks just like a new mail item that I create WITHOUT Automation (by clicking the new mail button and then dragging the spam mail onto the new mail item and clicking send, which does not result in an MDaemon "Incorrect Message Format" reply.

I also tried [automation] saving the spam email item as a file and attaching the file to the new mail item. Which again functions correctly but I get the MDaemon reply still

I also tried changing the defaults on the add attachment method
objNewMsg.Attachments.Add objMsg, 1, 1, objMsg.Subjec

Please help me... this is driving me batty! :)
 
G

Guest

Wow... no ideas from anyone on this? It seems like such a simple thing, I wonder why it isnt working. I'ved tried every combination I can think of and other code examples I've seen on the net to make this work. I'm left with wondering why there isn't an outlook method called "ForwardAsAttachment".
 
S

Sue Mosher [MVP-Outlook]

There doesn't need to be a separate method, since you can attach any Outlook
item to a message with the MailItem.Attachments.Add method.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Tom said:
Wow... no ideas from anyone on this? It seems like such a simple thing, I
wonder why it isnt working. I'ved tried every combination I can think of
and other code examples I've seen on the net to make this work. I'm left
with wondering why there isn't an outlook method called
"ForwardAsAttachment".
 
G

Guest

Ok, but something is different, because I can manually add an Outlook Mail Item by dragging the Mail Item onto a new Mail Item and clicking send on the New Mail Item... Mdaemon accepts the message. When I use VBA Automation, MDaemon does not accept the message.
 
S

Sue Mosher [MVP-Outlook]

I'd start my troubleshooting by comparing the full message source of the two
methods, maybe by sending to an account accessible with OE.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Tom said:
Ok, but something is different, because I can manually add an Outlook Mail
Item by dragging the Mail Item onto a new Mail Item and clicking send on the
New Mail Item... Mdaemon accepts the message. When I use VBA Automation,
MDaemon does not accept the message.
 

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