PDA

View Full Version : asp.net email with confirmation of send


david7777
05-08-2003, 10:42 AM
I searched other threads, but couldnt seem to find an answer... Maybe i didnt look hard enough?

I want to send email with asp.net - i know how to do that, but how do i know if it sent or not? So that i can tell the user that the mail was sent succesfully or that it failed.

angiras
05-11-2003, 11:05 AM
just do a try catch bloc

Public Sub send(ByVal from As String, ByVal [to] As String, ByVal subject As String, ByVal body As String)

Dim mm As New System.Web.Mail.MailMessage()

mm.From = from
mm.To = [to]
mm.Subject = subject
mm.Body = body

mm.BodyFormat = System.Web.Mail.MailFormat.Html
mm.BodyEncoding = System.Text.Encoding.GetEncoding("iso-8859-1")
mm.Priority = MailPriority.Normal

System.Web.Mail.SmtpMail.SmtpServer = ConfigurationSettings.AppSettings("SMTP")
try
System.Web.Mail.SmtpMail.Send(mm)
catch
'do what you want
end try

End Sub

david7777
05-12-2003, 10:19 AM
Thenx angiras! :thumbsup: