%@ LANGUAGE="VBSCRIPT" %>
<% option explicit %>
<%Response.CacheControl="Public"%>
<% Response.Buffer = True %>
<%
'Declare Variables
Dim smtpserver,sendtoemail,emailpassword,Contact_Quantity,Contact_Phone,Contact_Zipcode,Contact_Name,Contact_Company,Contact_Email,Contact_Country
Dim Contact_Subject,Contact_Body,Action,IsError
' Edit these to your needs
smtpserver = "relay-hosting.secureserver.net"
sendtoemail = "info@palettesmetalliques.com"
emailpassword = "buyitnow"
' Get variables from the form post
Contact_Quantity = Request("Contact_Quantity")
Contact_Name = Request("Contact_Name")
Contact_Company = Request("Contact_Company")
Contact_Phone = Request("Contact_Phone")
Contact_Email = Request("Contact_Email")
Contact_Zipcode = Request("Contact_Zipcode")
Contact_Country = Request("Contact_Country")
Contact_Subject = "Palettes Métalliques"
Contact_Body = Request("Contact_Body")
Action = Request("Action")
' Used to check that the email entered is in a valid format
Function IsValidEmail(Email)
Dim ValidFlag,BadFlag,atCount,atLoop,SpecialFlag,UserName,DomainName,atChr,tAry1
ValidFlag = False
If (Email <> "") And (InStr(1, Email, "@") > 0) And (InStr(1, Email, ".") > 0) Then
atCount = 0
SpecialFlag = False
For atLoop = 1 To Len(Email)
atChr = Mid(Email, atLoop, 1)
If atChr = "@" Then atCount = atCount + 1
If (atChr >= Chr(32)) And (atChr <= Chr(44)) Then SpecialFlag = True
If (atChr = Chr(47)) Or (atChr = Chr(96)) Or (atChr >= Chr(123)) Then SpecialFlag = True
If (atChr >= Chr(58)) And (atChr <= Chr(63)) Then SpecialFlag = True
If (atChr >= Chr(91)) And (atChr <= Chr(94)) Then SpecialFlag = True
Next
If (atCount = 1) And (SpecialFlag = False) Then
BadFlag = False
tAry1 = Split(Email, "@")
UserName = tAry1(0)
DomainName = tAry1(1)
If (UserName = "") Or (DomainName = "") Then BadFlag = True
If Mid(DomainName, 1, 1) = "." then BadFlag = True
If Mid(DomainName, Len(DomainName), 1) = "." then BadFlag = True
ValidFlag = True
End If
End If
If BadFlag = True Then ValidFlag = False
IsValidEmail = ValidFlag
End Function
%>
Nous contacter
<%
If Action = "SendEmail" Then
' Validates form
If Contact_Quantity = "" Then
IsError = "Yes"
Response.Write("Veuillez remplir une quantité. ")
End If
If Contact_Name = "" Then
IsError = "Yes"
Response.Write("Veuillez remplir votre nom. ")
End If
If Contact_Company = "" Then
IsError = "Yes"
Response.Write("Veuillez remplir le nom de votre entreprise. ")
End If
If Contact_Phone = "" Then
IsError = "Yes"
Response.Write("Veuillez remplir votre numéro de téléphone. ")
End If
If IsValidEmail(Contact_Email) = "False" Then
IsError = "Yes"
Response.Write("Veuillez saisir une adresse valide. ")
End If
If Contact_Zipcode = "" Then
IsError = "Yes"
Response.Write("Veuillez remplir le code postale de livraison. ")
End If
If Contact_Country = "" Then
IsError = "Yes"
Response.Write("Veuillez saisir votre pays. ")
End If
End If
' If there are no input errors and the action of the form is "SendEMail" the email is sent
If Action = "SendEmail" And IsError <> "Yes" Then
Dim strBody
' html body in the email
strBody = strBody & "From http://" & Request.ServerVariables("HTTP_HOST") & vbCrLf & " "
strBody = strBody & "Nom" & " : " & " " & Replace(Contact_Name,vbCr," ") & " "
strBody = strBody & "Entreprise" & " : " & " " & Replace(Contact_Company,vbCr," ") & " "
strBody = strBody & "Téléphone" & " : " & " " & Replace(Contact_Phone,vbCr," ") & " "
strBody = strBody & "Courriel" & " : " & " " & Replace(Contact_Email,vbCr," ") & " "
strBody = strBody & "Quantité" & " : " & " " & Replace(Contact_Quantity,vbCr," ") & " "
strBody = strBody & "Code postale de livraison" & " : " & " " & Replace(Contact_Zipcode,vbCr," ") & " "
strBody = strBody & "Pays" & " : " & " " & Replace(Contact_Country,vbCr," ") & " "
strBody = strBody & "Comment utiliserez-vous ces palettes?" & " : " & " " & Replace(Contact_Body,vbCr," ") & " "
strBody = strBody & ""
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")
'This section provides the configuration information for the remote SMTP server.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserver
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = sendtoemail
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = emailpassword
ObjSendMail.Configuration.Fields.Update
'End remote SMTP server configuration section==
ObjSendMail.To = sendtoemail
ObjSendMail.Subject = Contact_Subject
ObjSendMail.From = Contact_Email
' we are sending a html email.. simply switch the comments around to send a text email instead
ObjSendMail.HTMLBody = strBody
'ObjSendMail.TextBody = strBody
ObjSendMail.Send
Set ObjSendMail = Nothing
' change the success messages below to say or do whatever you like
' you could do a response.redirect or offer a hyperlink somewhere.. etc etc
%>
<% Response.Redirect "merci2.htm" %>