Pull info from database than send that info via email?

Discussion in 'ASP General' started by Kenshin, Jun 25, 2004.

  1. Kenshin

    Kenshin Guest

    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 = ""
    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%>
     
    Kenshin, Jun 25, 2004
    #1
    1. Advertisements

  2. Kenshin

    Jeff Cochran Guest

    On Fri, 25 Jun 2004 08:39:54 -0700, "Kenshin"
    <> 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 = ""
    >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%>
     
    Jeff Cochran, Jun 25, 2004
    #2
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave Bartlett

    how to send error reports via email?

    Dave Bartlett, Jun 14, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    417
    Atul Mittal
    Jun 14, 2004
  2. =?Utf-8?B?QW5kcmVhcw==?=

    Send email via external SMTP Server

    =?Utf-8?B?QW5kcmVhcw==?=, Jan 14, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    6,940
    Juan T. Llibre
    Jan 18, 2005
  3. Replies:
    1
    Views:
    453
    Peter Rilling
    Dec 22, 2005
  4. Replies:
    2
    Views:
    2,512
    Mike Treseler
    Jun 28, 2006
  5. navyliu

    How to send Lotus Notes Email Via C#

    navyliu, Dec 16, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    8,919
    John Timney \(MVP\)
    Dec 16, 2006
  6. Eric Layman
    Replies:
    3
    Views:
    688
    sloan
    May 10, 2007
  7. Newbie

    How to send email via ASP.net

    Newbie, Jun 7, 2007, in forum: ASP General
    Replies:
    0
    Views:
    130
    Newbie
    Jun 7, 2007
  8. groupie
    Replies:
    1
    Views:
    278
    Anthony Jones
    Dec 30, 2007
Loading...