Sendind email with asp.net

Discussion in 'ASP.NET 2.0' started by alvaradd, May 11, 2008.

  1. Hello,


    I'm trying to send an email with Asp.net but I'm getting this message:


    System.Net.Mail.SmtpException was unhandled by user code
    Message="Failure sending mail."
    Source="System"



    I don't know if I'm missing something also I would like toconfirm the smtp settings


    I'm using this code:


    Imports System.Net.Mail

    Partial Class Contact
    Inherits System.Web.UI.Page

    Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick
    SendMail(txtEmail.Text, txtComments.Text)

    End Sub

    Private Sub SendMail(ByVal from As String, ByVal body As String)
    Dim mailServerName As String = "server"
    Dim message As MailMessage = New MailMessage(from, "user", "feedback", body)
    Dim mailClient As SmtpClient = New SmtpClient
    mailClient.Host = mailServerName
    mailClient.Send(message)
    message.Dispose()

    End Sub
    End Class



    Can someone help me please?


    Thank you
     
  2. Can someone tell me what are the settings to send email with discount email account please?


    Thank you.
     
  3. Make sure you use 'localhost' as the smtp server. SMTP authentication will not be required when using localhost.

    rcp
    DiscountASP.NET
    www.DiscountASP.NET
     

Share This Page