<%
Function SendMail(strFrom, strTo, strSubject, strBody)
Dim objMail
Dim intErr
Dim SendOK
'On Error Resume Next
' Bad email
If chkEmail(strFrom) = 1 Then
SendMail = False
Exit Function
End If
' Bad email
If chkEmail(strTo) = 1 Then
SendMail = False
Exit Function
End If
'--- Create an instance of the ASPMail SMTP objMail object.
'Set objMail = Server.CreateObject("SMTPsvg.Mailer")
'objMail.FromName = "iada-cc.com"
'objMail.FromAddress = strFrom
'objMail.RemoteHost = "mail.iada-cc.com"
'objMail.AddRecipient strTo, strTo
'objMail.ContentType = "text/html"
'objMail.Subject = strSubject
'objMail.BodyText = strBody
Set objMail = Server.CreateObject("Persits.MailSender")
objMail.FromName = strFrom
objMail.From = strFrom
objMail.AddReplyTo strFrom
objMail.Host = "mail.iada-cc.com"
objMail.Username = "webmail@iada-cc.com"
objMail.Password = "zu@ie6jseKI"
objMail.AddAddress strTo
objMail.Subject = strSubject
objMail.Body = strBody
objMail.IsHTML = True
'on error resume next '## Ignore Errors
objMail.SendToQueue
'If Err <> 0 Then
' SendMail = False
' 'Err_Msg = Err_Msg & "
Your request was not sent due to the following error: " & Err.Description & ""
'Else
SendMail = True
'End if
'Response.Write objMail.FromName & "
"
'Response.Write objMail.FromAddress & "
"
'Response.Write objMail.RemoteHost & "
"
'Response.Write strTo & "
"
'on error resume next '## Ignore Errors
'SendOk = objMail.SendMail
'Response.Write CInt(SendOk) & "
"
'If not(SendOk) <> 0 Then
' SendMail = objMail.Response
'Else
' SendMail = True
'End if
'Set objMail = Server.CreateObject("SoftArtisans.SMTPMail")
'--- Set the Remote SMTP Host through which to send the email.
'objMail.RemoteHost = "localhost"
'objMail.FromAddress = strFrom
'objMail.AddRecipient "" , strTo
'objMail.Subject = strSubject
'objMail.HtmlText = strBody
'If objMail.SendMail Then
' SendMail = True
'Else
' SendMail = objMail.response
'End if
'response.write "SMTP Response " & CInt(SendOK) & "
"
'Set objMail = CreateObject("CDONTS.NewMail")
'objMail.From = strFrom
'objMail.To = strTo
'objMail.Subject = strSubject
'objMail.BodyFormat = 0
'objMail.MailFormat = 0
'objMail.Body = strBody
'objMail.Send
'If Err.Number = 0 Then
' SendMail = True
'Else
' SendMail = False
'End If
Set objMail = Nothing
End Function
'Check for valid email
function chkEmail(strAddress)
' checks for a vaild email
' returns 1 for invalid addresses
' returns 0 for valid addresses
dim atCnt
chkEmail = 0
' chk length
if len(strAddress) < 5 then
' a@b.c should be the shortest an
' address could be
chkEmail = 1
' chk format
' has at least one "@"
elseif instr(strAddress,"@") = 0 then
chkEmail = 1
' has at least one "."
elseif instr(strAddress,".") = 0 then
chkEmail = 1
' has no more than 3 chars after last "."
elseif len(strAddress) - instrrev(strAddress,".") > 3 then
chkEmail = 1
' has no "_" after the "@"
elseif instr(strAddress,"_") <> 0 and _
instrrev(strAddress,"_") > instrrev(strAddress,"@") then
chkEmail = 1
else
' has only one "@"
atCnt = 0
for i = 1 to len(strAddress)
if mid(strAddress,i,1) = "@" then
atCnt = atCnt + 1
end if
next
if atCnt > 1 then
chkEmail = 1
end if
' chk each char for validity
for i = 1 to len(strAddress)
if not isnumeric(mid(strAddress,i,1)) and _
(lcase(mid(strAddress,i,1)) < "a" or _
lcase(mid(strAddress,i,1)) > "z") and _
mid(strAddress,i,1) <> "_" and _
mid(strAddress,i,1) <> "." and _
mid(strAddress,i,1) <> "@" and _
mid(strAddress,i,1) <> "-" then
chkEmail = 1
end if
next
end if
end function
Sub SendAccountApproved(ID)
Dim Email, Username, Password, FirstName, LastName, Approved
If Not GetMemberEmailInfo(ID, Email, Username, Password, FirstName, LastName, MemberType, Approved) Then
'Response.Write "Member Not Found"
Exit Sub
End If
'Response.Write Email & " " & Username & " " & Password & " " & FirstName & " " & MemberType & " " & Approved
strFrom = Application("RegisterMailTo")
strTo = Email
If Approved Then
strSubject = "IADA-CC " & MemberType & " Membership Accepted"
strBody = "" & vbCrLf _
& "" & vbCrLf _
& "" & vbCrLf _
& "
IADA-CC Membership Information" & vbCrLf _
& "
" & vbCrLf _
& "" & vbCrLf _
& "" & vbCrLf _
& "Your Membership has been accepted and your Member login has been activated
Here is your IADA-CC Membership Information
" & vbCrLf _
& "Your Login Username: " & Username & "
" & vbCrLf _
& "Your Login Password: " & Password & vbCrLf _
& "
Member Login" & vbCrLf _
& "" & vbCrLf _
& "" & vbCrLf
Else
strSubject = "IADA-CC " & MemberType & " Membership Status"
strBody = "" & vbCrLf _
& "" & vbCrLf _
& "" & vbCrLf _
& "
IADA-CC Membership Information" & vbCrLf _
& "
" & vbCrLf _
& "" & vbCrLf _
& "" & vbCrLf _
& "Your Membership is currently pending approval
Here is your IADA-CC Membership Information
" & vbCrLf _
& "Your Login Username: " & Username & "
" & vbCrLf _
& "Your Login Password: " & Password & vbCrLf _
& "
www.iada-cc.com" & vbCrLf _
& "" & vbCrLf _
& "" & vbCrLf
End If
SendMail strFrom, strTo, strSubject, strBody
'Response.Write strFrom & " " & strTo
End Sub
Function EmailMembers(EmailFrom,EmailSubject,EmailMsg,MemberType,Approved)
Dim rsMem
Dim SQL
Dim strBody, strTo
Dim i
SQL = "SELECT Email, UserName, Password, FirstName, LastName, Company FROM Member WHERE MemberType IN(" & MemberType & ") AND " & Approved
Set rsMem = Server.CreateObject("ADODB.Recordset")
rsMem.ActiveConnection = Application("MM_IACCDA_STRING")
rsMem.Source = SQL
rsMem.CursorType = 0
rsMem.CursorLocation = 2
rsMem.LockType = 1
rsMem.Open()
i = 0
While Not rsMem.EOF
' Send Email
strBody = "" & vbCrLf _
& "" & vbCrLf _
& "" & vbCrLf _
& "
IADA-CC Membership Information" & vbCrLf _
& "
" & vbCrLf _
& "" & vbCrLf _
& "" & vbCrLf _
& EmailMsg & vbCrLf _
& "
Your Account
Username: " & rsMem("UserName") & "
Password: " & rsMem("Password") & vbCrLf _
& "" & vbCrLf _
& "" & vbCrLf
i = i + 1
strTo = rsMem("Email")
SendMail EmailFrom, strTo, EmailSubject, strBody
rsMem.MoveNext
Wend
rsMem.Close
Set rsMem = Nothing
EmailMembers = i
End Function
Function GetMemberEmailInfo(ID, Email, Username, Password, FirstName, LastName, MemberType, Approved)
Dim rsMem
Dim MemFound
Set rsMem = Server.CreateObject("ADODB.Recordset")
MemFound = False
rsMem.ActiveConnection = Application("MM_IACCDA_STRING")
rsMem.Source = "SELECT Email, Username, Password, FirstName, LastName, MemberType, Approved FROM Member WHERE MemberID=" & ID
rsMem.CursorType = 0
rsMem.CursorLocation = 2
rsMem.LockType = 1
rsMem.Open()
If Not rsMem.EOF Or Not rsMem.BOF Then
Email = rsMem("Email")
Username = rsMem("Username")
Password = rsMem("Password")
FirstName = rsMem("FirstName")
LastName = rsMem("LastName")
MemberType = rsMem("MemberType")
Approved = rsMem("Approved")
MemFound = True
End If
GetMemberEmailInfo = MemFound
rsMem.Close
Set rsMem = Nothing
End Function
%>
<%
Dim SendResults
strFrom = Application("RegisterMailTo")
strTo = Request.Form("Email")
strSubject = "IADA-CC " & Request.Form("MemberType") & " Membership"
strBody = "" & vbCrLf _
& "" & vbCrLf _
& "
" & vbCrLf _
& "
IADA-CC Membership Information" & vbCrLf _
& "
" & vbCrLf _
& "" & vbCrLf _
& "" & vbCrLf _
& "Thank you for joining IADA-CC
" & vbCrLf _
& "Your Login Name: " & Request.Form("UserName") & "
" & vbCrLf _
& "Your Login Password: " & Request.Form("Password") & "
" & vbCrLf _
& "Your account will become active when payment has been recieved by IADA-CC.
" & vbCrLf _
& "
www.IADA-CC.com" & vbCrLf _
& "" & vbCrLf _
& "" & vbCrLf
SendResults = SendMail(strFrom, strTo, strSubject, strBody)
If Request.Form("MemberType") = "Dealer" Then
PayAmt = "79.95"
item_number = "1"
item_name = "IADA-CC " & Request.Form("MemberType") & " Membership"
Else
PayAmt = "19.95"
item_number = "2"
item_name = "IADA-CC " & Request.Form("MemberType") & " Membership"
End If
%>
<% If (MM_abortEdit) Then %>
We are unable to process your <%= Request.Form("MemberType") %> Membership Application.
We already have a submited application for <%= Request.Form("Email") %>
<% Else %>
Thank You.
<% If SendResults Then %>
We have recieved your <%= Request.Form("MemberType") %> Membership Application
and have sent a confirmation email to <%= Request.Form("Email") %>
<% Else %>
We have recieved your <%= Request.Form("MemberType") %> Membership Application
and are not able to send a confirmation email to <%= Request.Form("Email") %>
due to send error <%= SendResults %>
<% End If %>
We have recieved your <%= Request.Form("MemberType") %> Membership Application
and have sent a confirmation email to <%= Request.Form("Email") %>
To complete the application process click the "PayPal" button. If you do not have a "PayPal" account you may easily set one up or send us payment in the amount of $<%= PayAmt %> to :
IADA-CC
PO Box BOX 848486
Hollywood, FL 33084
<% End If %>