Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generating Email Conformations 1

Status
Not open for further replies.

webdevop

MIS
Sep 18, 2003
11
US
If I have all my order data in a table including customers email, order amount, etc ...
Can ASP generate an autoemail from this data ?
for every order in the table ?

Thanks, Matt
 
Yes, is the answer. All you need is to have some sort of mailing component (such as Jmail or CDONTS installed on the webserver).

Just loop through the entries in the database, creating text strings with the email contents. e.g.

If Not rs.EOF Then
Do Until rs.EOF
'Loop through the recordset

Dim strMsg
'Create a message for each record

strMsg = "Dear " & rs("NAME") & vbcrlf 'use vbcrlf for a line break in plain text email or <br/> etc for HTML email

strMsg = strMsg & "Your order number is :" & rs("ORDERNUMBER") & vbcrlf

strMsg = strMsg & "The total amount was: " & rs("TOTALAMOUNT") & vbcrlf

'The following bit will change depending on what component you are using; this example is for jMail

'Send the message with the component


Dim msg
set msg = Server.CreateObject( "JMail.Message" )
msg.Logging = true
msg.silent = false
msg.From = "you@yourwebsite.com"
msg.AddRecipient rs("EMAIL")
msg.Subject = "Your Order"
msg.Body = strMsg 'HTMLBody if its html
msg.Send(
'Repeat for the other records
rs.MoveNext
Loop
End If

YOu get the gist...

I hope this helps


Nick (Webmaster)

info@npfx.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top