By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,417 Members | 1,845 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,417 IT Pros & Developers. It's quick & easy.

Pull info from database than send that info via email?

P: n/a
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 = "a@a.com"
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%>

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Fri, 25 Jun 2004 08:39:54 -0700, "Kenshin"
<Ke*****@discussions.microsoft.com> wrote:
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
<%
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 = "a@a.com"
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%>


Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.