%@ LANGUAGE="VBSCRIPT" %>
<% option explicit %>
<% Response.Buffer = True %>
<%
'Declaring Variables
Dim smtpserver,youremail,yourpassword,naam,emailadres,bedrijfsnaam
Dim adres,onderwerp,Action,IsError
' Edit these 3 values accordingly
smtpserver = "mail.publicip.nl"
youremail = "info@temacobv.nl"
yourpassword = "yourpassword"
' Grabbing variables from the form post
naam = Request("naam")
emailadres = Request("emailadres")
onderwerp = "Aanmelding nieuwsbrief via de website"
bedrijfsnaam = Request("bedrijfsnaam")
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
%>
<%
If Action = "SendEmail" Then
If naam = "" Then
IsError = "Yes"
End If
If IsValidEmail(emailadres) = "False" Then
IsError = "Yes"
End If
End If
' If there were no input errors and the action of the form is "SendEMail" we send the email off
If Action = "SendEmail" And IsError <> "Yes" Then
Dim strBody
' Here we create a nice looking html body for the email
strBody = strBody & "Aanmelding nieuwsbrief verstuurd op " & Now() & vbCrLf & "
"
strBody = strBody & "Van http://" & Request.ServerVariables("HTTP_HOST") & vbCrLf & "
"
strBody = strBody & "IP " & Request.ServerVariables("REMOTE_ADDR") & vbCrLf & "
"
strBody = strBody & "Email" & " : " & " " & Replace(emailadres,vbCr,"
") & "
"
' strBody = strBody & "Subject" & " : " & " " & Replace(onderwerp,vbCr,"
") & "
"
dim cdoMessage, cdoConfig
set cdoMessage = Server.CreateObject("CDO.Message")
set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserver
cdoConfig.Fields.Update
set cdoMessage.Configuration = cdoConfig
cdoMessage.From = emailadres
cdoMessage.To = youremail
cdoMessage.Subject = onderwerp
cdoMessage.HtmlBody = strBody
on error resume next
cdoMessage.Send
if Err.Number <> 0 then
SendMail = "Email send failed: " & Err.Description & "."
end if
set cdoMessage = Nothing
set cdoConfig = 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("/nieuws/bedankt.html")
%>
<% Else %>

TeMaCo brengt elk kwartaal een digitale nieuwsbrief uit met daarin de nieuwste ontwikkelingen. Wil je op de hoogte blijven van alles wat er bij ons speelt, meld je dan aan voor onze nieuwsbrief.
<% End If %>