Author |
|
David Poirier Guest Group
Joined: 10 November 2003
Online Status: Online Posts: 262
|
Posted: 27 June 2005 at 9:16pm | IP Logged
|
|
|
I am using the IMAP4 and SMTP components. I want to loop through all of the messages in my IMAP4 Inbox, creating a new message each time and attaching the existing message to the new message before sending it.
In order words, I want to forward each message in my Inbox as an attachment on a new message. I want to be able to open the attached message in Outlook, so it would need to be in the binary ".msg" format that Outlook seems to use.
How can I do this?
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 28 June 2005 at 8:32am | IP Logged
|
|
|
You can forward message as attachment by saving original message into a file and then appending this file to the forwarded message:
Code:
' Assume Msg1 is a source message (which came from IMAP)
' Assume SMTP.Message is a forwarded message
Msg1.SaveMessage "C:\Temp\Original message.eml"
SMTP.Message.AddAttachment "C:\Temp\Original message.eml", "message/rfc822"
' Msg was forwarded with SMTP.Message. Is't now save to delete or overwrite "C:\Temp\Original message.eml" file
|
|
|
If you wish to make original message have different filename in the forwarded message,
you can also specify FilenameInMessage parameter of AddAttachment method:
Code:
SMTP.Message.AddAttachment "C:\Temp\tempfile.tmp", "message/rfc822", "Meeting request.eml"
|
|
|
You can also force original message have no filename at all (Yahoo mail uses this format when forwarding) by specifying FilenameInMessage="<none>":
Code:
SMTP.Message.AddAttachment "C:\Temp\tempfile.tmp", "message/rfc822", "<none>"
|
|
|
Regards,
Alex
|
Back to Top |
|
|
David Poirier Guest Group
Joined: 10 November 2003
Online Status: Online Posts: 262
|
Posted: 29 June 2005 at 10:44pm | IP Logged
|
|
|
This works Alex, I was leaving off the MIME type "message/rfc822".
Here's a suggestion: add "Reply", "ReplyAll", and "Forward" methods to the "Message" object, and have each of them return a new message ready to go. The "Forward" method should have an option to include the original message quoted/unquoted inline or as an attachment.
Thank you.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 30 June 2005 at 8:54am | IP Logged
|
|
|
Thank you for the suggestion. We'll consider this for future versions.
Regards,
Alex
|
Back to Top |
|
|