Hi,
I would like to ask how to attach a file as an attachment in the mail. i have try but it does not work. however, no error message was produced.
this is my code:
Dim message As New System.Web.Mail.MailMessagemessage.To = "li-ching.ooi@avagotech.com"
message.From = txtMail1.Text
message.Subject = txtsubject.Text
message.Body = txtMsg.Text
message.Attachments.Add(txtAttach.Text)
'Try ' SmtpMail.Send(message) Try
SmtpMail.SmtpServer = "relay.smtp.avagotech.net"
SmtpMail.Send(message)

include attachment in SMTPMail
Jeffrey D. Baker - MS
denis kahl
NewToExpress
勇敢的心
That code works just fine - what doesnt work - does it give you any errors if so what errors
What version of VB are you using - VB2003/2005/Express
VisualDBA
Aaron Humphrey
there were no error message. i put my code in try/catch method but also no error. but it skips several codes and jump to those codes after the end try.
i am using visual studio 2003 to develop my system by writing the codes in vb.net.
Toni T
Try this:
Dim message As New System.Web.Mail.MailMessage
message.To = "li-ching.ooi@avagotech.com"
message.From = txtMail1.Text
message.Subject = txtsubject.Text
message.Body = txtMsg.Text
Dim ATCH as MailAttachment = new MailAttachment(txtAttach.text)
message.Attachments.Add(ATCH)
kbarlar
JohnCronin
You should probably validate that the file specified in txtAttach.text actually exists. Also, remember you need the full path with the filename.
Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
Tinu
Shifarad
The following has an example of just what your looking for.
http://www.freevbcode.com/ShowCode.asp ID=5486