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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDONTS Reply Question 1

Status
Not open for further replies.
May 9, 2000
446
GB
Hi, I've setup a mailing list and was wondering, if one of the emails sent out doesn't exist where will the delivery failure notice email go to?

Cheers
 
Another question! My code works as below....

2 recordsets, one with email addresses other with details that need sendinging.

Repeat Recordset1
Create Mail oobject
Some HTML (a kinda intro...)**
Repeat Recordset2
Details
Next Recordset2
Email to: details etc
Next recordset1

Basically the first person ion the list to be sent an email gets it fine, it looks good. The second person gets the mail fine but right at the end the part 'Some HTML**' (see above) is repeated once. The third person on the list gets this bit twice, the fourth three times and so on...

Can anyone help me with this? Please!
 
Can u post ur full code re the email part, and how many emails are getting sent out in one go? Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
Question #2'

When creating your body (some HTML) you are probably concatenating.

htmlBody = htmlBody & " more text "...


Make sure that you clear htmlBody....

htmlBody = ""

Before you continue with the second iteration of your loop.

As to question #1, I'm not sure on that one....

[laser][turkey] -- Just trying to help... LOL [ponder]
 
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<%
Dim objMail
Dim MyCDONTSMail13
Set objMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
'MyCDONTSMail3.AttachFile Server.MapPath(&quot;/logo12.jpg&quot;)
'objMail.AttachURL &quot;E:\internalaudit\images\pencil.gif&quot;, &quot;myImage2.gif&quot;

HTML = HTML & &quot;<HTML>&quot;
HTML = HTML & &quot;<HEAD>&quot;
HTML = HTML & &quot;<TITLE>Vanilla Pod Gigs</TITLE>&quot;
HTML = HTML & &quot;</HEAD>&quot;
HTML = HTML & &quot;<BODY bgcolor=&quot;&quot;#000000&quot;&quot;>&quot;
HTML = HTML & &quot;<font face=&quot;&quot;Arial, Helvetica, sans-serif&quot;&quot;>&quot;
'HTML = HTML & &quot;<A HREF=&quot;&quot; 'HTML = HTML & &quot;<IMG SRC=&quot;&quot;myImage.jpg&quot;&quot;></A><BR><BR>&quot;
HTML = HTML & &quot;<FONT color=&quot;&quot;White&quot;&quot; SIZE=&quot;&quot;5&quot;&quot;>&quot;
HTML = HTML & &quot;Vanilla Pod Gigs Mailing List</FONT>&quot;
HTML = HTML & &quot;</FONT>&quot;
HTML = HTML & &quot;<FONT color=&quot;&quot;Red&quot;&quot; SIZE=&quot;&quot;3&quot;&quot;>&quot;
HTML = HTML & &quot; (Please do not reply to this email!)</FONT>&quot;
HTML = HTML & &quot;</FONT>&quot;
HTML = HTML & &quot;<Font Color=&quot;&quot;White&quot;&quot;>&quot;
HTML = HTML & &quot;<p>&quot;
HTML = HTML & &quot;<FONT color=&quot;&quot;White&quot;&quot; SIZE=&quot;&quot;3&quot;&quot; face=&quot;&quot;Arial, Helvetica, sans-serif&quot;&quot;>&quot;
HTML = HTML & &quot;New gigs has been posted on the Vanilla Pod website see below for details:</FONT>&quot;
HTML = HTML & &quot;</p>&quot;
HTML = HTML & &quot;<p>&quot;%>


<%
Dim Repeat2__numRows
Repeat2__numRows = -1
Dim Repeat2__index
Repeat2__index = 0
Recordset2_numRows = Recordset2_numRows + Repeat2__numRows
%>

<%
While ((Repeat2__numRows <> 0) AND (NOT Recordset2.EOF))
HTML = HTML & &quot;<font face=&quot;&quot;Arial, Helvetica, sans-serif&quot;&quot;>&quot;
HTML = HTML & &quot;<Font Color=&quot;&quot;Grey&quot;&quot;>&quot;
HTML = HTML & &quot;Date: &quot;
HTML = HTML & &quot;</Font&quot;
HTML = HTML & &quot;<Font Color=&quot;&quot;White&quot;&quot;>&quot;
HTML = HTML & (Recordset2.Fields.Item(&quot;One&quot;).Value)
HTML = HTML & &quot;</Font&quot;
HTML = HTML & &quot;<Font Color=&quot;&quot;grey&quot;&quot;>&quot;
HTML = HTML & &quot; - Venue: &quot;
HTML = HTML & &quot;</Font&quot;
HTML = HTML & &quot;<Font Color=&quot;&quot;White&quot;&quot;>&quot;
HTML = HTML & (Recordset2.Fields.Item(&quot;Venue&quot;).Value)
HTML = HTML & &quot;</Font&quot;
HTML = HTML & &quot;<Font Color=&quot;&quot;grey&quot;&quot;>&quot;
HTML = HTML & &quot; - Other Bands: &quot;
HTML = HTML & &quot;</Font&quot;
HTML = HTML & &quot;<Font Color=&quot;&quot;white&quot;&quot;>&quot;
HTML = HTML & (Recordset2.Fields.Item(&quot;Bands&quot;).Value)
HTML = HTML & &quot;</Font&quot;
HTML = HTML & &quot;<hr>&quot;
HTML = HTML & &quot;</Font>&quot;
HTML = HTML & &quot;<p>&quot;
HTML = HTML & &quot;</p>&quot;
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
Recordset2.MoveNext()
Wend
HTML = HTML & &quot;<Font Size=&quot;&quot;-1&quot;&quot; color&quot;&quot;#CCCCCC&quot;&quot;>&quot;
HTML = HTML & &quot;visit &quot;
HTML = HTML & &quot;<a href=&quot;&quot;Biog.htm&quot;&quot;> </a>&quot;
HTML = HTML & &quot; for the news, pitures, mp3s and other stuff info. If you did not ask to be on this list or want to be removed, please email &quot;
HTML = HTML & &quot;<a href=&quot;&quot;mailto:MailingList@vanillapod.org&quot;&quot;> mailinglist@vanillapod.org </a>&quot;
HTML = HTML & &quot; with Remove in the subject (or you can reply to this email with 'remove' in the subject).&quot;
HTML = HTML & &quot;</Font>&quot;
HTML = HTML & &quot;<p>&quot;
HTML = HTML & &quot;</p>&quot;
HTML = HTML & &quot;</Font>&quot;
HTML = HTML & &quot;</Font>&quot;


HTML = HTML & &quot;</Font>&quot;

HTML = HTML & &quot;</BODY>&quot;
HTML = HTML & &quot;</HTML>&quot;

objMail.From = &quot;Vanilla Pod&quot;
objMail.Subject = &quot;New gig posted...&quot;

'you need TO add these lines FOR the mail
'to be sent in HTML format
objMail.BodyFormat = 0
objMail.MailFormat = 0

objMail.To = (Recordset1.Fields.Item(&quot;Email&quot;).Value)
objMail.Value(&quot;Reply-To&quot;) = &quot;mailinglist@vanillapod.org&quot;
objMail.Body = HTML
objMail.Send

Response.write(&quot;An Email Has Been Sent To &quot;)
Response.write(Recordset1.Fields.Item(&quot;Email&quot;).Value)
Response.write(&quot;<p></p>&quot;)
set objMail = nothing
htmlBody = &quot;&quot;
%>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
 
there ya go! I just added and tried the htmlBody = &quot;&quot; and its still doing it... have i put it in the right place?

Cheers for the help!
 
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<%
Dim objMail
Dim MyCDONTSMail13
Set objMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
'MyCDONTSMail3.AttachFile Server.MapPath(&quot;/logo12.jpg&quot;)
'objMail.AttachURL &quot;E:\internalaudit\images\pencil.gif&quot;, &quot;myImage2.gif&quot;
HTML = &quot;&quot;
HTML = HTML & &quot;<HTML>&quot;
HTML = HTML & &quot;<HEAD>&quot;
HTML = HTML & &quot;<TITLE>Vanilla Pod Gigs</TITLE>&quot;
HTML = HTML & &quot;</HEAD>&quot;
-- Just trying to help... LOL [ponder]
 
mwolf00 cheers for that... now the first email sent is fine but the subsequent emails only have the header text, they don't have the second repeated region at all or if they do its not writing anything!
 
It looks like you might need to use two separate HTML strings. One that is used on all emails and is never erased. The second is specific to that email. Note the way I concatenated &quot;specificBody&quot; - save a lot of typing...

mainBody = &quot;Place your main HTML body here&quot;
mainEnd = &quot;Place any closing tags from mainBody here&quot;

do while not RS.EOF
specificBody = &quot;Start recordSet specific body here &quot; &_
&quot;and continue to create your string with concatentation &quot;&_
&quot;just like you were doing before.&quot;

objMail.body = mainBody & specificBody & mainEnd
RS.movenext
loop -- Just trying to help... LOL [ponder]
 
Could you explain that a bit more? Sorry for being slooow! Where do i put that / what does it replace all of the HTML = HTML & stuff???

Cheers
 
I need to understand your two recordsets and how you loop through them a little bit more. What is in RS1? RS2? -- Just trying to help... LOL [ponder]
 
Here's the recordsets... i'm using Ultradev to create these for me...

<%
set Recordset1 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Recordset1.ActiveConnection = MM_TEsting1_STRING
Recordset1.Source = &quot;SELECT Name, Email, Id FROM List&quot;
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
set Recordset2 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Recordset2.ActiveConnection = MM_TESTING_STRING
Recordset2.Source = &quot;SELECT one, venue, bands, posted FROM GigsAll where posted = Date()&quot;
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 3
Recordset2.Open()
Recordset2_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>

 
I think I understand. You don't really want to nest these loops - you are making the server work too hard.

To create your,email body, do this:

mainBody = &quot;<HTML><TABLE><TR><TH colspan=4>Concerts</TH></TR>&quot;&_
&quot;<TR>&quot;&_
&quot;<TH>One</TH>&quot;&_
&quot;<TH>Venue</TH>&quot;&_
&quot;<TH>Bands</TH>&quot;&_
&quot;<TH>Posted</TH>&quot;&_
&quot;</TR>&quot;
DO WHILE NOT recordset2.EOF
if bgColor = &quot;grey&quot; THEN bgColor = &quot;white&quot; ELSE bgColor = &quot;grey&quot;
mainBody = mainBody &_
&quot;<TR bgColor='&quot;&bgColor&&quot;'>&quot;&_
&quot;<TD>&quot; & recordset2(&quot;one&quot;) & &quot;</TD>&quot; &_
&quot;<TD>&quot; & recordset2(&quot;venue&quot;) & &quot;</TD>&quot; &_
&quot;<TD>&quot; & recordset2(&quot;bands&quot;) & &quot;</TD>&quot; &_
&quot;<TD>&quot; & recordset2(&quot;posted&quot;) & &quot;</TD>&quot; &_
&quot;</TR&quot;>
recordset2.MOVENEXT
LOOP

'now that the body is created, mail it

DO WHILE NOT recordset1.EOF
Set objMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
with objMail
.From = &quot;Vanilla Pod&quot;
.Subject = &quot;New gig posted...&quot;
.BodyFormat = 0
.MailFormat = 0
.To = (Recordset1.Fields.Item(&quot;Email&quot;).Value)
.Value(&quot;Reply-To&quot;) = &quot;mailinglist@vanillapod.org&quot;
.Body = mainBody
.send
end with
set objMail = nothing
recordset1.MOVENEXT
LOOP -- Just trying to help... LOL [ponder]
 
Cheers for helping me with this! Anyway I ran it and got an error and had to remove the &quot;</TR&quot;> after the following lines...

&quot;<TD>&quot; & recordset2(&quot;one&quot;) & &quot;</TD>&quot; &_
&quot;<TD>&quot; & recordset2(&quot;venue&quot;) & &quot;</TD>&quot; &_
&quot;<TD>&quot; & recordset2(&quot;bands&quot;) & &quot;</TD>&quot; &_
&quot;<TD>&quot; & recordset2(&quot;posted&quot;) & &quot;</TD>&quot; &_

Now its saying it expects a wend at the end of my code... here's everything as i have it...

<%@LANGUAGE=&quot;VBSCRIPT&quot;%>

<%
set Recordset1 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Recordset1.ActiveConnection = MM_TEsting1_STRING
Recordset1.Source = &quot;SELECT Name, Email, Id FROM List&quot;
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
set Recordset2 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Recordset2.ActiveConnection = MM_TESTING_STRING
Recordset2.Source = &quot;SELECT one, venue, bands, posted FROM GigsAll where posted = Date()&quot;
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 3
Recordset2.Open()
Recordset2_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<%
mainBody = &quot;<HTML><TABLE><TR><TH colspan=4>Concerts</TH></TR>&quot;&_
&quot;<TR>&quot;&_
&quot;<TH>One</TH>&quot;&_
&quot;<TH>Venue</TH>&quot;&_
&quot;<TH>Bands</TH>&quot;&_
&quot;<TH>Posted</TH>&quot;&_
&quot;</TR>&quot;
DO WHILE NOT recordset2.EOF
if bgColor = &quot;grey&quot; THEN bgColor = &quot;white&quot; ELSE bgColor = &quot;grey&quot;
mainBody = mainBody &_
&quot;<TR bgColor='&quot;&bgColor&&quot;'>&quot;&_
&quot;<TD>&quot; & recordset2(&quot;one&quot;) & &quot;</TD>&quot; &_
&quot;<TD>&quot; & recordset2(&quot;venue&quot;) & &quot;</TD>&quot; &_
&quot;<TD>&quot; & recordset2(&quot;bands&quot;) & &quot;</TD>&quot; &_
&quot;<TD>&quot; & recordset2(&quot;posted&quot;) & &quot;</TD>&quot; &_

recordset2.MOVENEXT
LOOP

'now that the body is created, mail it

DO WHILE NOT recordset1.EOF
Set objMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
with objMail
.From = &quot;Vanilla Pod&quot;
.Subject = &quot;New gig posted...&quot;
.BodyFormat = 0
.MailFormat = 0
.To = (Recordset1.Fields.Item(&quot;Email&quot;).Value)
.Value(&quot;Reply-To&quot;) = &quot;mailinglist@vanillapod.org&quot;
.Body = mainBody
.send
end with
set objMail = nothing
recordset1.MOVENEXT
LOOP
%>
<%
Recordset2.Close()
%>
<%
Recordset1.Close()
%>

 
All of the opening and closing of your delimiters (%><%) is unecessary and makes the code harder to read.
<%@LANGUAGE=&quot;VBSCRIPT&quot;%>

<%
set Recordset1 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Recordset1.ActiveConnection = MM_TEsting1_STRING
Recordset1.Source = &quot;SELECT Name, Email, Id FROM List&quot;
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0

set Recordset2 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Recordset2.ActiveConnection = MM_TESTING_STRING
Recordset2.Source = &quot;SELECT one, venue, bands, posted FROM GigsAll where posted = Date()&quot;
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 3
Recordset2.Open()
Recordset2_numRows = 0

'I don't know what you want these 5 lines for
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows

'The follwing line was the problem - not needed in my code
'While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))

mainBody = &quot;<HTML><TABLE><TR><TH colspan=4>Concerts</TH></TR>&quot;&_
&quot;<TR>&quot;&_
&quot;<TH>One</TH>&quot;&_
&quot;<TH>Venue</TH>&quot;&_
&quot;<TH>Bands</TH>&quot;&_
&quot;<TH>Posted</TH>&quot;&_
&quot;</TR>&quot;
DO WHILE NOT recordset2.EOF
if bgColor = &quot;grey&quot; THEN bgColor = &quot;white&quot; ELSE bgColor = &quot;grey&quot;
mainBody = mainBody &_
&quot;<TR bgColor='&quot;&bgColor&&quot;'>&quot;&_
&quot;<TD>&quot; & recordset2(&quot;one&quot;) & &quot;</TD>&quot; &_
&quot;<TD>&quot; & recordset2(&quot;venue&quot;) & &quot;</TD>&quot; &_
&quot;<TD>&quot; & recordset2(&quot;bands&quot;) & &quot;</TD>&quot; &_
&quot;<TD>&quot; & recordset2(&quot;posted&quot;) & &quot;</TD>&quot; &_
recordset2.MOVENEXT
LOOP

'now that the body is created, mail it'

DO WHILE NOT recordset1.EOF
Set objMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
with objMail
.From = &quot;Vanilla Pod&quot;
.Subject = &quot;New gig posted...&quot;
.BodyFormat = 0
.MailFormat = 0
.To = (Recordset1.Fields.Item(&quot;Email&quot;).Value)
.Value(&quot;Reply-To&quot;) = &quot;mailinglist@vanillapod.org&quot;
.Body = mainBody
.send
end with
set objMail = nothing
recordset1.MOVENEXT
LOOP

Recordset2.Close()

Recordset1.Close()
%> -- Just trying to help... LOL [ponder]
 
WOW! That's great mwolf00 thanks loads, see what you mean about the <%%>'s as well, love the alternating green stripes as well!.... cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top