001  <% @ Language=VBScript %>
002  <%
003   Dim aPrograms, aDLUrls, strProgram
004  
005   aPrograms = Array("Euro Conversion Component","OdbcRegTool 2.0","AspTear 1.2")
006   aDLUrls = Array("full.zip","odbcregtool2.zip","asptear12.zip")
007  
008   strProgram = Trim(Request.QueryString("program"))
009   If "" = strProgram Or Not IsNumeric(strProgram) then
010   Response.Write "Fatal Error: No program was selected for downloading!"
011   Response.End
012   End If
013  
014   strProgram = Clng(strProgram)
015   If strProgram < 0 Or strProgram > Ubound(aPrograms) Then
016   Response.Write "Fatal Error: The requested program does not exist!"
017   Response.End
018   End If
019  
020   ' change according to your server setup and site preferences
021   strSMTPHost = "mail.alphasierrapapa.com"
022   strSenderEmail = "webmaster@alphasierrapapa.com"
023   strSenderDisplayName = "Automated Download"
024  %>

025  <HTML>
026  <HEAD>
027  <TITLE>Request <%=aPrograms(strProgram)%> via Email</TITLE>
028  </HEAD>
029  <BODY BGCOLOR="#ffffff">
030  <%
031  strAction = Request.QueryString("send")
032  
033  If strAction <> "yes" Then
034  %>

035  <FORM METHOD="GET" ACTION="<%=Request.ServerVariables("SCRIPT_NAME")%>">
036  <TABLE>
037  <TR>
038   <TD>Send to:</TD>
039   <TD><INPUT TYPE="TEXT" SIZE="30" NAME="Email"></TD>
040   <TD>
041   <input type="hidden" name="send" value="yes">
042   <input type="hidden" name="program" value="<%=strProgram%>">
043   <INPUT TYPE="SUBMIT" NAME="btnSubmit" VALUE="Send download">
044   </TD>
045  </TR>
046  </TABLE>
047  </FORM>
048  <%
049  Else
050   strSendTo = Trim(Request.QueryString("Email"))
051   ' a very simple check if the email address is correct
052   If Len(strSendTo) < 6 Or 0 = InStr(strSendTo, "@") Then
053   Response.Write "The email address you have entered is not correct!"
054   Else
055   Set Mailer = CreateObject("SoftArtisans.SMTPMail")
056   Mailer.FromName = strSenderDisplayName
057   Mailer.FromAddress = strSenderEmail
058   Mailer.RemoteHost = strSMTPHost
059   Mailer.AddRecipient "", strSendTo
060   Mailer.Subject = aPrograms(strProgram)
061  
062   strBodyText = "Attached is the download you requested to be sent to you via email." & vbCrLf
063   strBodyText = strBodyText & vbCrlf & "Thank you for your interest in our software!"
064   Mailer.BodyText = strBodyText
065  
066   Mailer.AddAttachment Server.MapPath(aDLUrls(strProgram))
067  
068   If Mailer.SendMail Then
069   Response.Write "The file " & aDLUrls(strProgram) & " is on its way to " & strSendTo
070   Else
071   Response.Write "An error has occured:<br><b>" & Mailer.Response & "</b>"
072   End If
073   Set Mailer = Nothing
074   End If
075  End If
076  %>

077  </BODY>
078  </HTML>