944,167 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 1209
  • ASP RSS
Dec 6th, 2007
0

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

Expand Post »
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"
%>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
doraima29 is offline Offline
19 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: Extracting data from csv then directly put it on body of email with ASP
Next Thread in ASP Forum Timeline: export body of email into .txt in ASP





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC