开发者

How to send email to the user with all data input

开发者 https://www.devze.com 2023-01-31 01:17 出处:网络
I have two pages the first one will receive all data that are required from the user such as username e.mail and then the same page will do the calculation but when clicking o开发者_运维知识库n result

I have two pages the first one will receive all data that are required from the user such as username e.mail and then the same page will do the calculation but when clicking o开发者_运维知识库n result button two things should happen: 1-the result and all user inputs should be sent to the second page 2- the same information should be sent to the user email as the e.mail messege

I wrote the e.mail code but I dont know how do put the results as message

Help please


This code worked for me

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
0

精彩评论

暂无评论...
验证码 换一张
取 消