我有两个页面,第一个将接收用户所需的所有数据,例如用户名e.mail,然后同一页面将进行计算,但是当点击结果按钮时,应该发生两件事:1 - 结果并且所有用户输入都应该发送到第二页2-相同的信息应该作为e.mail信息发送到用户的电子邮件
我编写了电子邮件代码,但我不知道如何将结果作为消息
请帮助
答案 0 :(得分:0)
这段代码对我有用
Try
Dim mail As MailMessage
Dim client As SmtpClient
Dim fromAddress As String
Dim toAddress As String
Dim subject As String
Dim message As String
fromAddress = "user@hotmail.com"
toAddress = "user@hotmail.com"
subject = "Radiation"
message = "mail sent"
mail = New MailMessage(fromAddress, toAddress, subject, message)
client = New SmtpClient("Smtp.live.com")
client.Port = 587
client.EnableSsl = True
client.UseDefaultCredentials = False
Dim SMTPUserInfo As New System.Net.NetworkCredential("user@hotmail.com", "password")
client.Credentials = SMTPUserInfo
client.Send(mail)
Label1.Text = "sent"
Catch ex As Exception
Label1.Text = ex.Message.ToString()
End Try