Support - Gestion de formulaire

Envoyer le résultat d'un formulaire à une adresse email




Windows 2000

Tout cela est fourni en standard par le composant CDONTS de Microsoft et fonctionnera sur tous les serveurs IIS du monde sans problemo

Inutile donc d'utiliser Frontpage ou des composants coûteux

Infos techniques Microsoft sur http://support.microsoft.com/support/kb/articles/Q186/2/04.ASP

Vous pouvez essayer aussi notre formulaire Netline à l'adresse suivante mailer.asp et le télécharger s'il vous plait à l'adresse mailer.zip

Voici les lignes de code qu'il vous faudra adapter à votre formulaire

 fromemail="info@netline.be"
 toemail=request.form("destinataire@netline.be")
 subject=request.form("objet du message ") 
 For i=1 To request.form.count
   strMessage = strMessage & request.form.key(i) & ": 
   " & request.form.item(i) & vbCrLf
 Next Dim objMail
 Set objMail = CreateObject("CDONTS.NewMail")
 objMail.Send fromemail,toemail,subject,strMessage
 if err Then
      response.Write err.Description 
 Else
      response.write "Message Sent!"
 End if


Windows 2003

Sous IIS6, Microsoft recommande CDOSYS

Since Windows XP, Microsoft is not including CDONTS on its operating systems. Instead it uses the new and more powerful mail component CDOSYS that was already present in Windows 2000.

 Dim Flds
 Dim strHTML
 Dim strSmartHost     Const cdoSendUsingPort = 2
 StrSmartHost = "mail.example.com" set iMsg = CreateObject("CDO.Message")
 set iConf = CreateObject("CDO.Configuration")Set Flds = iConf.Fields
 ' set the CDOSYS configuration fields to use port 25 on the SMTP server
   With Flds
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing")
	= cdoSendUsingPort
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")
	= strSmartHost
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
	= 10
    .Update
  End With
  ' build HTML for message body
         strHTML = "<HTML>"
         strHTML = strHTML & "<HEAD>"
         strHTML = strHTML & "<BODY>"
         strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
         strHTML = strHTML & "</BODY>"
         strHTML = strHTML & "</HTML>"
		 ' apply the settings to the message
         With iMsg
         Set .Configuration = iConf
         .To = "eric@liege.com"
         .From = "eric@netline.be"
         .Subject = "This is a test CDOSYS message (Sent via Port 25)"
         .HTMLBody = strHTML
         .Send
         End With
		 ' cleanup of variables
         Set iMsg = Nothing
         Set iConf = Nothing
         Set Flds = Nothing