CDOSYS Mail

This is a discussion on "CDOSYS Mail" within the Classic ASP section. This forum, and the thread "CDOSYS Mail are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Oct 11th, 2005, 12:31
New Member
Join Date: Oct 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
CDOSYS Mail

Hi

Was wondering if anybody could help me with this. I am trying to create a page that sends out an email based upon records in my database. I can get the script to work fine if I just send one message. However, when I try to get it to repeat and loop through the records I get an error and only one email is sent. Can anybody help? Here is the code

Dim Connect, Recordset1

Set Connect = Server.CreateObject("ADODB.Connection")


Connect.Open "dsn=StaffDr;uid=mcoker;pwd=mcoker;"
Set Recordset1 = Connect.Execute("SELECT * FROM dbo.TestContact")
do until Recordset1.eof%><%

'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
'Outgoing SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "myserver"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objCDOSYSCon.Fields.Update

'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon
objCDOSYSMail.From = "***@***.com"
objCDOSYSMail.To = (Recordset1.Fields.Item("ContactEmail").Value)
objCDOSYSMail.Subject = "HR Information Update Request"
objCDOSYSMail.HTMLBody = "Please login to check the information that HR currently holds on you


</p> username: "&(Recordset1.Fields.Item("Username").Value)&"
Password: "&(Recordset1.Fields.Item("Password").Value)&"

</p>To view this request please click here http://localhost/blah?blah=1"
objCDOSYSMail.Send
'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing
%>
<%recordset1.movenext
loop

%>


Any help you can offer would be really appreciated

Thanks

Marcus
Reply With Quote

  #2 (permalink)  
Old Oct 15th, 2005, 00:31
Highly Reputable Member
Join Date: May 2005
Location: U.K
Age: 21
Posts: 739
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbramz
whats the error you recieve?
Reply With Quote
  #3 (permalink)  
Old Mar 17th, 2006, 06:03
New Member
Join Date: Mar 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CDOSYS Mail

Not sure if this will be the answer to your problem or not, but I am doing a similar action using a text file for my database. As a result, I'm not using the ADO connections, but my code works with multiple e-mails by using a loop, maybe it will help, or possibly inspire a different approach to your problem? Here's what I use (clearly this is just the nuts and bolts, and not the complete code, but it should give you an idea.):

set alladdys = fso.OpenTextFile(server.mappath ("emails.txt"))
do until (alladdys.AtEndOfStream)
addys = alladdys.ReadLine
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = from
objMail.To = addys
objMail.Subject = projectname
objMail.BodyFormat = 0
objMail.MailFormat = 0
objMail.Body = MailBody
objMail.Send
loop

Hope that helps!

Qixsilver
Reply With Quote
Reply

Tags
cdosys, mail

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Having Problems with cdosys emails Phil Classic ASP 1 Sep 12th, 2007 17:23
Creating a contact form on homepage with ASP & CDOSYS? Foobster Classic ASP 0 Aug 14th, 2007 09:01
CDOSYS problem Ranger Classic ASP 8 Dec 21st, 2005 09:09
visitors name not displayed in mail after filling in mail form made on earth PHP Forum 7 Nov 16th, 2005 22:43
CDOSYS AndyP Hosting & Domains 2 Sep 7th, 2005 12:15


All times are GMT. The time now is 20:48.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43