Imports System.Web.Mail
Imports System.IO
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oMsg As MailMessage = New MailMessage()
' TODO: Replace with sender e-mail address.
oMsg.From = "sender@somewhere.com"
' TODO: Replace with recipient e-mail address.
oMsg.To = "sjasser38@gmail.com"
oMsg.Subject = "Send using Web Mail"
' SEND IN HTML FORMAT (comment this line to send plain text).
oMsg.BodyFormat = MailFormat.Html
'HTML Body (remove HTML tags for plain text).
oMsg.Body = "<HTML><BODY><B>Hello World!</B></BODY></HTML>"
' ADD AN ATTACHMENT.
' TODO: Replace with path to attachment.
' TODO: Replace with the name of your remote SMTP server.
SmtpMail.SmtpServer = "MySMTPServer"
SmtpMail.Send(oMsg)
oMsg = Nothing
End Sub
اذا حاولت ارسال البريد من صفحة ASP
يحدث الخطأ التالي :
فشل النقل في الاتصال بالملقم.
