You cannot use the short version to send e-mails with attachements.
It will be something like this:
objMessage = New MailMessage()
With objMessage
.From = Me.MailFrom
.To = Me.MailTo
.Cc = Me.MailCC
.Bcc = Me.MailBCC
.Subject = Me.MailSubject
.Body = Me.MailBody
.BodyEncoding = Me.MailBodyEncoding
.BodyFormat = Me.MailBodyFormat
.Priority = Me.MailPriority
Dim strAttach As String
strAttachments = Me.MailAttachments
For Each strAttach In strAttachments.Split(";"c)
If File.Exists(strAttach) Then
.Attachments.Add(New MailAttachment(strAttach))
End If
Next
End With
SmtpMail.SmtpServer = Me.SMTPServer()
SmtpMail.Send(objMessage)
You need to add files one by one using this:
>Hi .. All,
>
>I need to send email thru my vb.net app, what I don't understand is how to attach some files to email by using my vb.net 's codes below:
>
>Imports System.Web.Mail
>
> Public Sub SendMail(ByVal pRecepient As String, ByVal pSubject As String, ByVal pBody As String)
> If pubSendMail = True Then
> System.Web.Mail.SmtpMail.SmtpServer = pubMailServer
> System.Web.Mail.SmtpMail.Send( _
> pubEmailAddress, pRecepient, pSubject, pBody)
> End If
> End Sub
>
>please advise .. thanks
>
>Regards
>Winanjaya
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com