A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Resend an attachment which is an email



 
 
Thread Tools Search this Thread Display Modes
  #2  
Old February 5th 08, 07:03 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Resend an attachment which is an email



First, you need to save the attachment as a file; call its SaveAsFile
method. you can then create the MailItem with the CreateItemFromTemplate
function.

--
Best regards
Michael Bauer - MVP Outlook
Outlook Categories? The Tool:
http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6

Am Mon, 4 Feb 2008 21:08:00 -0800 schrieb Tony29:

There are a lot of questions/answers related to finding and saving
attachments but I think this is a little different.

I receive emails from a site's indicating that the
email that I sent it could not be delivered. However I know that if I

send
my email again it will eventually be delivered. It's just a glitch with
xxx.com.

The email that I receive from
contains as an
attachment the email that I sent in the first place - there is nothing

else
that would help me identify the original email that I sent (which by now

is
somewhere in my Sent Items folder).

I want to take the attachment from the returned email and simply resend

it.

I have so far ...

I have found the email that has been returned by
and
then called ...
Public Sub ProcessUndeliveredResponseFromxxx(eMail As MailItem)

Dim Attachment As Outlook.Attachment
For Each Attachment In eMail.Attachments
If Right(Attachment.FileName, 4) = ".msg" Then

' This is me guessing
Dim NewEmail As Outlook.MailItem
NewEmail = Attachment
NewEmail.Send
Set NewEmail = Nothing
' This is the end of guessing

End If
Next
Set Attachment = Nothing

End Sub

Can someone provide the missing/incorrect logic?

TIA

  #3  
Old February 6th 08, 02:47 AM posted to microsoft.public.outlook.program_vba
Tony29
external usenet poster
 
Posts: 5
Default Resend an attachment which is an email

Thanks for your help - it took me a while to realise that I should use the
saved attachment as the template (sleep helps!) but I got there. Your
suggestion works as follows ...

For Each Attachment In eMail.Attachments
If Right(Attachment.FileName, 4) = ".msg" Then
Attachment.SaveAsFile TempFolder & Attachment.FileName
Set NewItem = Application.CreateItemFromTemplate _
(TempFolder &
Attachment.FileName)
NewItem.Send
eMail.UnRead = False
eMail.Delete
Kill TempFolder & Attachment.FileName
End If
Next

Thanks.

"Michael Bauer [MVP - Outlook]" wrote:



First, you need to save the attachment as a file; call its SaveAsFile
method. you can then create the MailItem with the CreateItemFromTemplate
function.

--
Best regards
Michael Bauer - MVP Outlook
Outlook Categories? The Tool:
http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6

Am Mon, 4 Feb 2008 21:08:00 -0800 schrieb Tony29:

There are a lot of questions/answers related to finding and saving
attachments but I think this is a little different.

I receive emails from a site's indicating that the
email that I sent it could not be delivered. However I know that if I

send
my email again it will eventually be delivered. It's just a glitch with
xxx.com.

The email that I receive from
contains as an
attachment the email that I sent in the first place - there is nothing

else
that would help me identify the original email that I sent (which by now

is
somewhere in my Sent Items folder).

I want to take the attachment from the returned email and simply resend

it.

I have so far ...

I have found the email that has been returned by
and
then called ...
Public Sub ProcessUndeliveredResponseFromxxx(eMail As MailItem)

Dim Attachment As Outlook.Attachment
For Each Attachment In eMail.Attachments
If Right(Attachment.FileName, 4) = ".msg" Then

' This is me guessing
Dim NewEmail As Outlook.MailItem
NewEmail = Attachment
NewEmail.Send
Set NewEmail = Nothing
' This is the end of guessing

End If
Next
Set Attachment = Nothing

End Sub

Can someone provide the missing/incorrect logic?

TIA


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I can send email with attachment receiver cannot open attachment saffi Outlook - General Queries 8 December 5th 07 11:06 AM
Email attachment symbol, but no attachment xylophone Outlook Express 11 October 5th 07 03:17 AM
Sending email with attachment produces error message but email is OW Outlook Express 3 June 24th 06 09:59 PM
resend email with form or from calendar appointment? Mr . . Outlook - Using Forms 8 January 29th 06 05:11 AM
resend email from calendar event? Mr . . Outlook - General Queries 1 January 27th 06 05:18 PM


All times are GMT +1. The time now is 07:06 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.