<%@LANGUAGE = "VBSCRIPT"%> <% ' ================== MAILSENDER v. 1.0 ================== ' Code compiled by Will Collis [will@netsibition.co.uk] ' ' I do not provide any warranty or support. ' I am NOT liable for any use or misuse of this script. ' If you have any problems or queries. Google for it. ' HTMLArea v2 is by InteractiveTools [www.htmlarea.com] ' ' NB: The attachment functionality sends files from the ' computer that the script resides on. For Localhost use ' you are OK to attach. If you are using this on a server ' you should remember that the file path relates to the ' server's file structure, even the though the dialogue ' box asks for files on the client computer. You should ' remove or modify this yourself if this is a problem. ' ' If I get the time, I may well release a full-blown "v.2" ' with various email component support and a file upload ' for better attachment management. Thanks & Enjoy. ' ======================================================= ' ======================================================= ' LEON - ERROR CHECKING - VALID EMAIL ' ======================================================= 'Begin with basic RegExp function to validate email addresses Function EmailCheck(sEmail) EmailCheck = false Dim regEx, retVal Set regEx = New RegExp regEx.Pattern ="^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,4}$" regEx.IgnoreCase = true retVal = regEx.Test(sEmail) If not retVal Then exit function End If EmailCheck = true End Function ' ======================================================= ' LEON - STORES CURRENT TIME AS VAR ' ======================================================= DateTime = Now() 'Store current time as variable %> American Autoclave Company - Email Inquiry

 

 

 

 

 

 

 

 

 

 

 

 

 



American Autoclave Quote Request Form


<% If Request.Querystring("send") = "True" Then fmTo="robert@americanautoclave.com" fmFrom="leon@americanautoclave.com" fmFromName="AAC Website Inquiry" fmCC="mrstack@comcast.net" fmSubject="New Inquiry at the American Autoclave Co. Website" 'fmTo = Trim(Request.Form("fmTo")) 'fmFrom = Trim(Request.Form("fmFrom")) 'fmFromname = Trim(Request.Form("fmFromName")) 'fmCC = Trim(Request.Form("fmCC")) 'fmSubject = Trim(Request.Form("fmSubject")) ' ======================================================= ' LEON - ADDED ENTRIES ' ======================================================= fmName = Trim(Request.Form("fmName")) fmCompany = Trim(Request.Form("fmCompany")) fmPhone = Trim(Request.Form("fmPhone")) fmFax = Trim(Request.Form("fmFax")) fmEmail = Trim(Request.Form("fmEmail")) fmCity = Trim(Request.Form("fmCity")) fmState = Trim(Request.Form("fmState")) fmCountry = Trim(Request.Form("fmCountry")) fmSource = Trim(Request.Form("fmSource")) ' ======================================================= fmBody = Trim(Request.Form("fmBody")) Call SendMail(fmTo,fmFrom,fmFromName,fmCC,fmSubject,fmName,fmCompany,fmPhone,fmFax,fmEmail,fmCity,fmState,fmCountry,fmSource,fmBody) Else Response.Write("For more information, please complete and submit the form below.

An American Autoclave Representative will follow up with you shortly.") End If %>




Your Name
Company
Phone Number (Including area-code)
Fax Number (Including area-code)
Your e-mail address
Your Location (City)
(State/Province)
(Your Country)
Where did you hear about us?
Comments (How may we help you?):

 
<% ' ======================================================= ' LEON - SEND MAIL ROUTINE ' ======================================================= 'Begin Routine to Send Mail Sub SendMail(smTo,smFrom,smFromName,smCC,smSubject,smName,smCompany,smPhone,smFax,smEmail,smCity,smState,smCountry,smSource,smBody) On Error Resume Next 'To catch any potential errors in the sending inqBody = "

***This is an automated response to your inquiry with American Autoclave Company.***


The following is a summary of what you have submitted:
" & "
  • Your Name: " & smName & "
" & "
  • Company: " & smCompany & "
" & "
  • E-Mail: " & smEmail & "
" & "
  • Phone: " & smPhone & "
" & "
  • Fax: " & smFax & "
" & "
  • Location (City): " & smCity & "
" & "
  • (State/Province): " & smState & "
" & "
  • (Country): " & smCountry & "
" & "
  • Found us through: " & smSource & "
" & "
  • Comments: " & smBody & "


" & "We will respond to your inquiry shortly.
In the meantime, if you have any questions or comments, or would just like to drop us a line... We welcome you to contact us at the following:


American Autoclave Co.
http://www.americanautoclave.com
rfstack@comcast.net
West Coast: 253-863-5000
East Coast: 706-692-4480
Central States: 425-836-5086
" emlBody = "

An Inquiry has been made at www.americanautoclave.com


" & "
  • Name: " & smName & "
" & "
  • Company: " & smCompany & "
" & "
  • E-Mail: " & smEmail & "
" & "
  • Phone: " & smPhone & "
" & "
  • Fax: " & smFax & "
" & "
  • Location (City): " & smCity & "
" & "
  • (State/Province): " & smState & "
" & "
  • (Country): " & smCountry & "
" & "
  • Referred From: " & smSource & "
" & "
  • Comments: " & smBody & "
" 'Response.Write("You should see something following:") 'Response.Write(emlBody) 'Response.Write(smTo) 'Response.Write(smFrom) 'Response.Write(smFromName) 'Response.Write(smCC) 'Response.Write(smSubject) 'Response.Write(smName) 'Response.Write(smCompany) 'Response.Write(smPhone) 'Response.Write(smFax) 'Response.Write(smEmail) 'Response.Write(smCity) 'Response.Write(smState) 'Response.Write(smCountry) 'Response.Write(smSource) 'Response.Write(" <- Before here.") smCCall = smCC & "; " & "leon@americanautoclave.com" 'This is the list of AAC recipients for the Submitted Inquiry emails strErr = "" 'Init variable to store any error message If EmailCheck(smEmail) = False Then strErr = strErr & "
  • The provided e-mail Address seems to be incorrect.
  • " End If If Len(smFromName) > 0 Then smFromage = smFromName & "<" & smFrom & ">" End If smSubject = smCompany & " - " & smSubject ' ======================================================= ' LEON - FORM HAS PASSED DATA VALIDATION, NOW SEND ' ======================================================= If strErr = "" Then 'If form data has passed basic validation then send Set iMsg = CreateObject("CDO.Message") iMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 iMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" iMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 iMsg.Configuration.Fields.Update With iMsg .To = smTo .From = smFromage ' If Len(smCC) > 0 Then 'Commented out since we are cc'ing .CC = smCCall ' End If .Subject = smSubject .HTMLBody = emlBody ' .TextBody = smComments ' If Len(smAttach) > 0 Then ' Set iBp = .AddAttachment(smAttach) ' End If .Send 'SEND MAIL End With ' ======================================================= ' LEON - NOW CLEAN UP AFTER OURSELVES ' ======================================================= 'Clean Up Set iMsg = Nothing Set thnxMsg = CreateObject("CDO.Message") thnxMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 thnxMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" thnxMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 thnxMsg.Configuration.Fields.Update With thnxMsg .To = smEmail .From = "leon@americanautoclave.com" .Subject = "Thank you for your interest - the American Autoclave Team!" .HTMLBody = inqBody .Send 'SEND MAIL End With ' ======================================================= ' LEON - NOW CLEAN UP AFTER OURSELVES ' ======================================================= 'Clean Up Set thnxMsg = Nothing 'If Len(smAttach) > 0 Then 'NOTE: KEPT AS EXAMPLE 'Set iBp = Nothing 'End If ' ======================================================= ' LEON - ERROR - SERVER - COMPONENT ERROR MESSAGE ' ======================================================= If Err > 0 Then 'If a server/component error occurred Response.Write("Mail Not Sent! Error(s) Occurred:") Response.Write("
    • " & Err.Description & "
    ") Else 'Success! Mail Sent Response.Write("

    Mail Sent!


    To: American Autoclave Co. on " & FormatDateTime(DateTime,vbLongDate) & " at " & FormatDateTime(DateTime,vbLongTime)) smName = "" smCompany = "" smPhone = "" smFax = "" smEmail = "" smCity = "" smState = "" smCountry = "" smSource = "" smComments = "" smTo = "" smFrom = "" smFromName = "" smCC = "" smSubject = "" smBody = "" End If ' ======================================================= ' LEON - ERROR - DATA - INPUT INCORRECT ERROR MESSAGE ' ======================================================= Else 'Else, Form data incorrect - write out the error(s) Response.Write("


    Mail Not Yet Sent...

    Please correct the following & Resend:") Response.Write("
      " & strErr & "