Bonjour,

J'ai développé une page de contact sur mon site , mais lorsque je teste le formulaire, celui-ci ne part pas.

Voici le code de la page en VB

Imports System.Net.Mail


Partial Class contact_fichiers_infos
Inherits System.Web.UI.Page

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub btnEnvoyer_Click(sender As Object, e As System.EventArgs) Handles btnEnvoyer.Click
Me.Validate()
If Me.IsValid Then
Try


Dim mm As New MailMessage("monpublic@free.fr", "contact@monpublic.fr")
mm.Subject = "[Public Contacts Infos] Contact"
mm.Body = "[Contact Transmis par le site Web]" _
& vbCr & lblNom.Text & txtNom.Text.ToUpper _
& vbCr & lblPrenom.Text & txtPrenom.Text _
& vbCr & lblAge.Text & dpLAge.Text _
& vbCr & lblGenre.Text & dpLGenre.Text _
& vbCr & lblMail.Text & txtMail.Text _
& vbCr & lblTel.Text & txtTel.Text _
& vbCr & lblCP.Text & txtCP.Text _
& vbCr & lblVille.Text & txtVille.Text.ToUpper _
& vbCr & lblNom.Text & txtNom.Text.ToUpper _
& vbCr & lblCommentaire.Text & txtCommentaire.Text.ToUpper


'Envoi du messge

Dim smtp As New SmtpClient
Me.PnlConfirmation.Controls.Add(New LiteralControl(smtp.Host))
smtp.Host = "localhost"
smtp.Send(mm)

Catch ex As Exception

lblMessageErreur.Text = "La page a rencontré une erreur.Vos données n'ont pas été envoyées !"

End Try

End If
Me.PnlMessage.Visible = False
Me.PnlConfirmation.Visible = True

End Sub

Protected Sub btnAnnuler_Click(sender As Object, e As System.EventArgs) Handles btnAnnuler.Click
txtNom.Text = String.Empty
txtPrenom.Text = String.Empty
dpLAge.Text = String.Empty
dpLGenre.Text = String.Empty
txtMail.Text = String.Empty
txtTel.Text = String.Empty
txtCP.Text = String.Empty
txtVille.Text = String.Empty
txtAdresse.Text = String.Empty
txtCommentaire.Text = String.Empty
lblMessageErreur.Text = String.Empty

End Sub
End Class