View Single Post
  #2  
Old May 31st 12, 10:29 PM
NDuarte NDuarte is offline
Junior Member
 
First recorded activity at Outlookbanter: May 2012
Posts: 6
Default

Try the following and let me know if it works:
Code:
Public Sub IP2(oMailItem As Outlook.MailItem)
  Dim oAttachment As Outlook.Attachment
  Dim oMail As MailItem
  Dim str_Body As String

  str_Body = "Your email with the following attachments has been received:" & vbNewLine & vbNewLine
  For Each oAttachment In oMailItem.Attachments
    str_Body = str_Body & oAttachment.DisplayName & vbNewLine
    Set objatt = Nothing
  Next

  str_Body = str_Body & vbNewLine & "Thanks," & vbNewLine & vbNewLine & "Chris"

  Set oMail = Application.CreateItem(olMailItem)

  With oMail
    .To = oMailItem.SenderEmailAddress
    .Subject = "Ref your email - " & oMailItem.Subject
    .Body = str_Body
    '.Display '**THis line is not needed if you are sending the e-mail.
    .Send
  End With

  Set oMail = Nothing

End Sub

Last edited by NDuarte : May 31st 12 at 10:32 PM. Reason: Put in Code brackets
Ads