Sending email with attachments

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to send an email with vb.net and I must be able to include multiple
attachments. When I use mailmessage, it says that the "To" is read only.
Any help?
 
I can't see the original post, but if you looking for code to send
email with attachments it's quite simple.

**********************************************************************

Private Sub SendEmail(ByVal Path As String, ByVal Too As String,
Optional ByVal Body As String = "")

Dim SendMessage As New SmtpClient
Dim Message As MailMessage = New
MailMessage(My.Settings.EmailFrom, Too, "EDI Transfer Report", Body)
Dim App As Attachment

If Path.Length > 0 And File.Exists(Path) Then
App = New Attachment(Path)
Message.Attachments.Add(App)
End If

SendMessage.Host = My.Settings.EmailServer
SendMessage.Send(Message)

End Sub

*************************************************************************
 
Back
Top