Print Page | Close Window

Help me ! 2 table , 1 mail...

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=15560
Printed Date: 30 March 2026 at 3:26am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Help me ! 2 table , 1 mail...
Posted By: BlueMask
Subject: Help me ! 2 table , 1 mail...
Date Posted: 23 June 2005 at 10:22am
Hi guys, i need your help! I tray to connect 2 tables. Then, when i take data, send mail.
 
<%
Response.Buffer = True
Dim strBody
Dim Konu
Dim Derece
Dim Mesaj
Dim objCDOMail
Dim strMyEmailAddress   
Dim strReturnEmailAddress 
Dim adoCon    
Dim Rs1
Dim strSQL1 
Dim Rs2
Dim strSQL2 
Dim SubeID
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("TestDB.mdb")

Set Rs1= Server.CreateObject("ADODB.Recordset")
strSQL1 = "SELECT * From Bireysel"
Rs1.Open strSQL1, adoCon
SubeID = Rs1("SubeID")
Set Rs2= Server.CreateObject("ADODB.Recordset")
strSQL2 = "SELECT * From Musteri where SubeID2 = '" & SubeID & "'"
Rs2.Open strSQL2, adoCon

Konu = Request.Form("Konu")
Derece = Request.Form("Derece")
Mesaj = Request.Form("Mesaj")
strMyEmailAddress = " mailto:ben@omertokus.com - ben@omertokus.com "
DO WHILE NOT Rs1.EOF
strBody = "Sayżn " & Rs1("Ad") & "," & "<br><br>"
strBody = strBody & Mesaj & "<br><br>"
strBody = strBody & Rs1("SubeID")
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From = strMyEmailAddress
objCDOMail.To = Rs1("Mail")
objCDOMail.BodyFormat = 0
objCDOMail.MailFormat = 0
objCDOMail.Subject = Konu
objCDOMail.Body = strBody
objCDOMail.Importance = Derece
objCDOMail.Send
Rs1.MoveNext
Loop
Set objCDOMail = Nothing
Rs1.Close
Set Rs1 = Nothing
Rs2.Close
Set Rs2 = Nothing
adoCon.Close
Set adoCon = Nothing
%>



Replies:
Posted By: dpyers
Date Posted: 23 June 2005 at 12:20pm
what doesn't work?

-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: BlueMask
Date Posted: 23 June 2005 at 1:01pm
Originally posted by dpyers dpyers wrote:

what doesn't work?
Yes, doesn't work!
i need to query in 2 table. Some data is the same. For example , we have to table ; x and y
 
in the x table some id = 1 and have mail address
in the y table some id = 1
 
i want to find them, and send mail automoticly.
 
can u help me ?


Posted By: wingking
Date Posted: 06 July 2005 at 4:07pm
Try This
 
<%
Response.Buffer = True
Dim strBody
Dim Konu
Dim Derece
Dim Mesaj
Dim objCDOMail
Dim strMyEmailAddress   
Dim strReturnEmailAddress 
Dim adoCon    
Dim Rs1
Dim strSQL1 
Dim Rs2
Dim strSQL2 
Dim SubeID
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("TestDB.mdb")

Set Rs1= Server.CreateObject("ADODB.Recordset")
strSQL1 = "SELECT * From Bireysel"
Rs1.Open strSQL1, adoCon
SubeID = Rs1("SubeID")
Set Rs2= Server.CreateObject("ADODB.Recordset")
strSQL2 = "SELECT * From Musteri where SubeID2 = '" & SubeID & "'"
Rs2.Open strSQL2, adoCon

Konu = Request.Form("Konu")
Derece = Request.Form("Derece")
Mesaj = Request.Form("Mesaj")
strMyEmailAddress = " mailto:ben@omertokus.com - ben@omertokus.com "
DO WHILE NOT Rs1.EOF
strBody = "Sayżn " & Rs1("Ad") & "," & "<br><br>"
strBody = strBody & Mesaj & "<br><br>"
strBody = strBody & Rs1("SubeID")
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From = strMyEmailAddress
objCDOMail.To = SubeID
objCDOMail.BodyFormat = 0
objCDOMail.MailFormat = 0
objCDOMail.Subject = Konu
objCDOMail.Body = strBody
objCDOMail.Importance = Derece
objCDOMail.Send
Rs1.MoveNext
Loop
Set objCDOMail = Nothing
Rs1.Close
Set Rs1 = Nothing
Rs2.Close
Set Rs2 = Nothing
adoCon.Close
Set adoCon = Nothing
%>
 
assuming that SubeID = Rs1("SubeID") is an email address or else it won't work.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net