G
Guest
Need your help in sending an email message with an attachment in my VB.Net program. Sending a body message is no problem. I don't know how to use the attachment property in an emai
Following is an excerpt from the program
Imports System.Web.Mai
Imports System.Web.HttpServerUtilit
Imports System.Diagnostics
Public Class Emailin
Inherits System.Web.UI Pag
Protected withEvents btnSubmit As System.Web.UI.WebControls.Butto
et
et
Private Sub btnSubmit(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Clic
Dim msgMail As New MailMessage(
Dim msgAttachment As MailAttachment(
'file access code to get an email addres
'file exist code to see if attachment file is availabl
'if email address and file attachment availabl
'set up message and attachmen
msgMail.To = "(e-mail address removed)" 'this work
msgMail.From = "(e-mail address removed)" 'this work
msgMail.Subject = "Quarterly Promotion Report" 'this works
msgMail.Bodyformat = Mailformat.Text 'this work
msgMail.Body = "Your Quarterly Promotion Report is attached" 'this work
msgMail.Attachments.Add(0) 'just guessing
msgMail.Attachments(0) = "qtrprorpt.pdf" 'just guessin
msgAttachment.GetValue(0) 'just guessin
SmtpMail.SmtpServer = "localhost" 'this work
SmtpMail.Send(msgMail) 'this work
SmtpMail.Send(msgAttachment) 'just guessin
Following is an excerpt from the program
Imports System.Web.Mai
Imports System.Web.HttpServerUtilit
Imports System.Diagnostics
Public Class Emailin
Inherits System.Web.UI Pag
Protected withEvents btnSubmit As System.Web.UI.WebControls.Butto
et
et
Private Sub btnSubmit(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Clic
Dim msgMail As New MailMessage(
Dim msgAttachment As MailAttachment(
'file access code to get an email addres
'file exist code to see if attachment file is availabl
'if email address and file attachment availabl
'set up message and attachmen
msgMail.To = "(e-mail address removed)" 'this work
msgMail.From = "(e-mail address removed)" 'this work
msgMail.Subject = "Quarterly Promotion Report" 'this works
msgMail.Bodyformat = Mailformat.Text 'this work
msgMail.Body = "Your Quarterly Promotion Report is attached" 'this work
msgMail.Attachments.Add(0) 'just guessing
msgMail.Attachments(0) = "qtrprorpt.pdf" 'just guessin
msgAttachment.GetValue(0) 'just guessin
SmtpMail.SmtpServer = "localhost" 'this work
SmtpMail.Send(msgMail) 'this work
SmtpMail.Send(msgAttachment) 'just guessin