Pull info from database than send that info via email?

K

Kenshin

Hey!

I have another script where i pull all the information from the database and I want to send it to the person. What they do is they enter in their email, and if the email matches, than it will email them their login information.

How do you grab the info and than use that info and put it into an email to send?

Here is my code thus far for it:



<%
Function SendEmail()

Dim myMail
Set myMail = CreateObject("CDONTS.NewMail")
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & NL
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<title>Login Information</title>"
HTML = HTML & "</head>"
HTML = HTML & "<center><b>Your Login Information</b></center>"
HTML = HTML & "<br>Dear: "
HTML = HTML & "<br><br>Here is your login information:"
HTML = HTML & "<br> <b>User Name: </b>"
HTML = HTML & "<br> <b>Password: </b>"
HTML = HTML & "<br><br> Please print this page for your records, and keep this information in a safe place. You can always check to see if there are any updates by going to that site. When there is an update available, we will send an email alerting you of this."
HTML = HTML & "<br><br> Thank you,"
HTML = HTML & "<br>3B Software Team"
HTML = HTML & "</body>"
HTML = HTML & "</html>"

myMail.From = "(e-mail address removed)"
myMail.To = Request.Form("email")
myMail.Subject = "Free Update Login Information"
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = HTML
myMail.Send

End Function
%>

<%
Response.Expires = -1000 'Make sure the browser doesnt cache this page
Response.Buffer = True 'enables our response.redirect to work

If Request.Form("valuepassed") ="true" Then
CheckSignUpForm
Else
ShowSignUpForm
End If
Sub CheckSignUpForm

Dim myconn, verify, blnLoggedIn, email, objRS
Set verify = Server.CreateObject("ADODB.Connection")
verify.open = "Provider=SQLOLEDB.1;Password=XXX;Persist Security Info=True;User ID=XXX;Initial Catalog=XXX;Data Source=XXX"

email = Request.Form("email")

Set objRS = verify.execute("SELECT id,ordernum, firstname, lastname, username, pass FROM regfreeup WHERE email='" & email & "';")
If objRS.EOF Then '''NO RECORDS MATCH. PROCEED WITH LOGIN CREATION
blnLoggedIn = False
Response.Redirect "http://www.microsoft.com"

Else '''EVERYTHING PASSED CHANGE EMAIL
blnLoggedIn = True
(no idea how to grab that info and put it into the email up top.)

SendEmail()
Response.Redirect "http://www.yahoo.com"
End If

verify.close
set verify = nothing

ShowSignUpForm
End Sub

%>

<% Sub ShowSignUpForm %>
form
<%end sub%>
 
J

Jeff Cochran

Hey!

I have another script where i pull all the information from the database and I want to send it to the person. What they do is they enter in their email, and if the email matches, than it will email them their login information.

How do you grab the info and than use that info and put it into an email to send?

Here is my code thus far for it:

First, do a Response.Write and make sure you're retrieving the info
correctly. To mail it, see:

http://www.aspfaq.com/show.asp?id=2119

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top