text file in the body of e-mail
I have this third party software that sends e-mails on our behalf. however these e-mail are attachments and alot of companys block attachments. So far im able to loop through the outbox and take the attachment and save them, however i need to copy and paste the text file in the body of the outlook e-mail.
here is the code I have so far all i need to do is figure out how to copy and paste the text content on the text file into the e-mail.
Thanks in advance and sorry if this dosent belong on this post.
[code]
Public Sub Attach()
Dim ns As NameSpace
Dim Outbox As MAPIFolder
Dim Item As Object
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
Set objWSHShell = CreateObject("WScript.Shell")
Set ns = GetNamespace("MAPI")
Set Outbox = ns.GetDefaultFolder(olFolderOutbox)
i = 0
If Outbox.Items.Count = 0 Then
MsgBox "There are no messages in the Outbox.", vbInformation, _
"Nothing Found"
Exit Sub
End If
For Each Item In Outbox.Items
For Each Atmt In Item.Attachments
FileName = "C:\Email Attachments\" & Atmt.FileName
Item.Display
Atmt.SaveAsFile FileName
Atmt.Delete
objWSHShell.Run ("notepad.exe Attach.txt") 'here i call the the notepad file to open
Item.Send
i = i + 1
Next Atmt
Next Item
If i > 0 Then
MsgBox "I found " & i & " attached files." _
& vbCrLf & "I have saved them into the C:\Email Attachments folder." _
& vbCrLf & vbCrLf & "Have a nice day.", vbInformation, "Finished!"
Else
MsgBox "I didn't find any attached files in your mail.", vbInformation, _
"Finished!"
End If
getattachments_exit:
Set Atmt = Nothing
Set Item = Nothing
Set ns = Nothing
Exit Sub
GetAttachments_err:
MsgBox "An unexpected error has occurred." _
& vbCrLf & "Please note and report the following information." _
& vbCrLf & "Macro Name: GetAttachments" _
& vbCrLf & "Error Number: " & Err.Number _
& vbCrLf & "Error Description: " & Err.Description _
, vbCritical, "Error!"
Resume getattachments_exit
End Sub
[\code]
|