doraima29 0 Newbie Poster

Hi,

I'm trying to import a .csv file containing discount codes on 1 column. I was wondering if it's possible to import data to the send_it.asp(This is a web form application) without any database like MySQL.

Also, I want to read each line until one user fills out a form, and then it starts to read and create the discount code from a .csv. Then import the data on the body of the email.

I will provide the code below for send_in.asp:
<%@ Language=VBScript %>

<%
Option Explicit
%>

<%
' -----------------------------------------------------
' CDONTS Email send script
' © http://www.designplace.org/
' Comments must remain intact for re-use of this code
' -----------------------------------------------------

dim strFName, strLName, strEmailOne, strEmailTwo, strMessage, optEducation, strEmailTo

strFName = Request.Form("fname") ' holds inputted name
strLName = Request.Form("lname") ' holds inputted name
'strEmailOne = Request.Form("emailOne") ' holds inputted email address
strEmailTwo = Request.Form("emailTwo") ' holds inputted email address
strMessage = Request.Form("message") ' holds inputted message
optEducation = Request.Form("educ_levels").Item ' drop down list selection of education levels each user primarily teaches

' -- check all fields for empty values --
' -- remove and add new as required --

'if strMessage = "" then
' Response.Redirect "suggestion_box.asp?action=err4"
'end if

' if strName = "" then
' Response.Redirect "suggestion_box.asp?action=err1"
' else if strEmailOne = "" then
' Response.Redirect "suggestion_box.asp?action=err2"
' else if strEmailTwo = "" then
'Response.Redirect "suggestion_box.asp?action=err3"
'else if strMessage = "" then
'Response.Redirect "suggestion_box.asp?action=err4"
'else if optSuggestions = "" then
'Response.Redirect "suggestion_box.asp?action=err5"
'end if
'end if
'end if
'end if
'end if

' -- start determine correct send to address based on suggestion type --

Select Case optEducation

Case "Preschool"
educ_levels = "Preschool"

Case "Elementary"
educ_levels = "Elementary Teachers and Staff"

Case "High School"
educ_levels= "High School Teachers and Staff"

Case "College"
educ_levels = "College Professors, Staff and Administrators"

Case "Child Development"
educ_levels = "Child Development Professionals"

Case "Special Education"
educ_levels = "Special Education Professionals"

Case "Counselors"
educ_levels = "Counselors"

Case "Parent or Guardian"
educ_levels = "Parent or Guardian"

Case Else
educ_levels = "Other"

End Select

' -- end determine correct send to address based on suggestion type --

' -- begin email send process --

dim objMail

Set objMail = Server.CreateObject("CDO.Message")
'Set objMail = CreateObject("CDONTS.NewMail")

' -- email variables --
objMail.From = Trim("feedback@avanquestusa.com")
objMail.To = Trim(strEmailTwo)
objMail.Subject = "Discount Code for Avanquest Educators Perks Program"
'objMail.BodyFormat = "0" ' HTML format
objMail.TextBody = "Hello" & Trim(strFName) & Trim(strLName) & vbCrLf _
& vbCrLf _
& "Thank you for signing up at AVQ Corporation and your discount code is." & Trim(strDCode) & vbCrLf _
& vbCrLf _
& "Put description of message here" & Trim(optSuggestions) & vbCrLf _
& vbCrLf _
& "You primarily teach at " & Trim(optEducation)

' -- send the email --
objMail.Send()

' -- clean up object
Set objMail = Nothing

' -- execute confirmation page
Response.Redirect "thankyou.asp"
%>

---------
strDCode = is the variable of trying to import a code from the .csv file. I need help getting this function to work. Please offer some suggestions and possibilities to approach this project. Thank you