如何将网页值发送到电子邮件

时间:2010-10-26 06:27:55

标签: .net asp.net vb.net

使用ASP.Net,VB.Net

在我的网页中,我有文本框值

当我按下发送按钮时,文本框值会自动发送到电子邮件地址...

怎么做......

需要代码帮助

2 个答案:

答案 0 :(得分:2)

代码示例如下:

Dim oMsg As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage()
oMsg.From = "noone@nobody.com"
oMsg.To = "someone@somewhere.com"
oMsg.Subject = "Email with Attachment Demo"
oMsg.Body = "This is the main body of the email"
Dim oAttch As MailAttachment = New MailAttachment("C:\myattachment.zip")
oMsg.Attachments.Add(oAttch)
SmtpMail.Send(oMsg)

您还可以找到一个示例;在以下链接中:

http://www.thescarms.com/dotnet/Email.aspx

答案 1 :(得分:1)