Bonjour à tout,
Je souhaiterai envoyer des emails depuis mon site (asp.net)
le code que j'utilise est la suivante :
Dim email As New System.Net.Mail.MailMessage()
Dim Client As New Net.Mail.SmtpClient
email.From = New Net.Mail.MailAddress("name@vision.ma", "name")
email.To.Add(New Net.Mail.MailAddress("name1@gmail.com", "name1"))
email.Subject = tbObjet.Text
email.IsBodyHtml = True
email.Body = "<html>" & _
"<head>" & _
"<meta http-equiv=""Content-Language"" content=""fr"">" & _
"<meta http-equiv=""Content-Type"" content=""text/html charset=windows-1252"">" & _
"</head>" & _
"<body>" & _
"<b>Email : </b>" & tbExpediteur.Text & _
"<br/><br/> <b>Message : </b><p>" & tbMessage.Text & "</p>" & _
"</body>" & _
"</html>"
Client.Host = "smtp.vision.ma"
Client.Credentials = New Net.NetworkCredential("name@vision.ma", "motdepasse")
Try
Client.Send(email)
lblErreur.Text = "Votre message à été correctement envoyé."
Catch ex As Exception
lblErreur.Text = ex.Message
End Try
quand je clic sur le boutton envoyé j'obtien le message d'erreur :
==> sur Internet Explorer et opera :
-------------------------------------------------------------------------
Server Error in '/Vision' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
-------------------------------------------------------------------------
===> et sur mozilla firefox : je reçois l'émail mais l'entête de message contient spam.(***SPAM*** Sujet).
J'espère que quelqu'un pourra m'aider et Merci d'avance.