954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Importing data from .csv then putting this on body of email

HI,

I'm trying to import data coming from a .csv file. The .csv file contains a column of coupon codes.

I have constructed a send email form made with ASP earlier. This will send a coupon code taken from the .csv file one at a time after a person completely registers the form. The coupon code from the .csv file will import on the body of the email.

I will be sending the send mail.asp code:
<%@ Language=VBScript %>

<%
Option Explicit
%>

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

dim strName, strEmailOne, strEmailTwo, strMessage, optSuggestions, strEmailTo

strName = Request.Form("name") ' 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
optSuggestions = Request.Form("suggestions").Item ' drop down list selection

' -- 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 optSuggestions

Case "Web Enhancements"
strEmailTo = "person1@offemail.com"

Case "Application Enhancements"
strEmailTo = "person2@offemail.com"

Case "New Product Suggestions"
strEmailTo = "person2@offemail.com"

Case "Workplace Suggestions"
strEmailTo = "person3@offemail.com"

Case "Employee Recognition"
strEmailTo = "person3@offemail.com"

Case "Cultural Events"
strEmailTo = "person3@offemail.com"

Case "Other"
strEmailTo = "person3@offemail.com"

Case Else
strEmailTo = "feedback@offemail.com"

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@offemail.com")
objMail.To = Trim(strEmailTo)
objMail.Subject = "Put name of program here"
'objMail.BodyFormat = "0" ' HTML format
objMail.TextBody = "put message here:" & vbCrLf _
& vbCrLf _
& "Question 1: " & Trim(optSuggestions) & vbCrLf _
& vbCrLf _
& "Message: " & Trim(strMessage)

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

' -- clean up object
Set objMail = Nothing

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

doraima29
Newbie Poster
19 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You