Not receiving email

I am not receiving the email of my contact form but the server smtp seems to be working and sending but im not receiving the email…

Imports System.Net.Mail

Public Class _FORMA
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(sender As Object, e As EventArgs)

    End Sub

    Protected Sub Button1_Click(sender As Object, e As EventArgs)
        Try
            Dim mailMessage As New MailMessage()
            mailMessage.[To].Add("myemail@host.com")
            mailMessage.Subject = txtSubject.Text

            mailMessage.Body = "<b>Sender Name : </b>" + txtname.Text + "<br/>" + "<b>Sender Email : </b>" + txtEmail.Text + "<br/>" + "<b>Comments : </b>" + txtComments.Text
            mailMessage.IsBodyHtml = True

            Dim client As New SmtpClient()
            client.Host = "relay-hosting.secureserver.net"
            client.Port = 25

            Label1.Text = "Thank for contacting us"
            Label1.ForeColor = System.Drawing.Color.Blue

            txtname.Enabled = False
            txtEmail.Enabled = False
            txtComments.Enabled = False
            txtSubject.Enabled = False
            Button1.Enabled = False
        Catch generatedExceptionName As Exception
            ' Log - Event Viewer or table 
            Label1.ForeColor = System.Drawing.Color.Blue
            Label1.ForeColor = System.Drawing.Color.Red
            Label1.Text = "There is an unknown problem. Please try later"
        End Try
    End Sub

    Protected Sub DropDownList1_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Protected Sub ddlCountries_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub


End Class


'=======================================================
'Service provided by Telerik (www.telerik.com)
'Conversion powered by NRefactory.
'Twitter: @telerik
'Facebook: facebook.com/telerik
'=======================================================

HI I am having trouble getting the message I send using a contact form. I am using godaddy smtp server because that is where my website is hosted. it seems to be the right server because the button works and it says “Thanks for contacting us” after but I receive no email. Here is my code behind file----->

Imports System.Net.Mail

Public Class _FORMA
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(sender As Object, e As EventArgs)

    End Sub

    
    Protected Sub Button1_Click(sender As Object, e As EventArgs)
        Try
            Dim mailMessage As New MailMessage()
            mailMessage.From = New MailAddress("webmaster@iogproducts.com")
            mailMessage.[To].Add("csosa@iogproducts.com")
            mailMessage.Subject = txtSubject.Text

            mailMessage.Body = "<b>Sender Name : </b>" + txtname.Text + "<br/>" + "<b>Sender Email : </b>" + txtEmail.Text + "<br/>" + "<b>Comments : </b>" + txtComments.Text
            mailMessage.IsBodyHtml = True

            Dim smtpClient As New SmtpClient("relay-hosting.secureserver.net", 25)

            Label1.Text = "Thanks for contacting us"
            Label1.ForeColor = System.Drawing.Color.Blue

            txtname.Enabled = False
            txtEmail.Enabled = False
            txtComments.Enabled = False
            txtSubject.Enabled = False
            Button1.Enabled = False
        Catch generatedExceptionName As Exception
            ' Log - Event Viewer or table 
            Label1.ForeColor = System.Drawing.Color.Blue
            Label1.ForeColor = System.Drawing.Color.Red
            Label1.Text = "There is an unknown problem. Please try later"
        End Try
    End Sub

    Protected Sub DropDownList1_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Protected Sub ddlCountries_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub


End Class


'=======================================================
'Service provided by Telerik (www.telerik.com)
'Conversion powered by NRefactory.
'Twitter: @telerik
'Facebook: facebook.com/telerik
'=======================================================

if there is no error in smtp then may be mail are going to spam.check spam folder

This is the Error…“Thanks for contacting us” .

That isn’t an error, the error in your code is you never told it to Send the message. You created the message, assigned all of its properties, but you never sent it! :smile:

but it says sent…Thanks for contacting us but I dont get the message…

You misunderstand us.

The page is going through with no errors. This means that your code is not broken. Cpradio is saying that the function to actually SEND the mail isn’t coded/being used.

The message sent that you are getting SHOULD BE HAPPENING. Ignore this message. It does nothing for you.

And to be specific you need this line added to your code:

smtpClient.Send(mailMessage)

Add it after

Dim smtpClient As New SmtpClient("relay-hosting.secureserver.net", 25)

Thanks Guys I appreciate your help really. .NET is new for me.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.