vb.net stuur e-mail

Ik vroeg me af hoe ik een e-mail kan verzenden vanuit een vb-toepassing? Kan iemand helpen waar te beginnen?


Antwoord 1, autoriteit 100%

Gebruik de SmtpClient-klasse binnen de System.Net. E-mailnaamruimte

Voorbeeld.

'create the mail message
Dim mail As New MailMessage()
'set the addresses
mail.From = New MailAddress("xx@xx")
mail.[To].Add("xx@xx")
'set the content
mail.Subject = "This is an email"
mail.Body = "this is a sample body"
'set the server
Dim smtp As New SmtpClient("localhost")
'send the message
Try
    smtp.Send(mail)
    Response.Write("Your Email has been sent sucessfully - Thank You")
Catch exc As Exception
    Response.Write("Send failure: " & exc.ToString())
End Try

Antwoord 2, autoriteit 20%

Je kunt de System.Net.Mailnaamruimte gebruiken, opzoeken en kijken of het helpt. Ik gebruik C#, maar ik stel me voor dat het vergelijkbaar is, maak een client, dan een bericht, stel de parameters van het bericht in en dan zal client.Send()het bericht verzenden.

Other episodes