flipandboef
Posts: 107
|
| Posted: 11/17/2006, 1:47 PM |
|
Ok I am quite a newbie when it comes to CCS but love using it so far.
I have no programming experience (but understand it when i read the code), but so far am able to many things I was looking for in CCS.
There's just this one thing I cannot seem to figure out: How do I create a page where the e-mail addresses are gathered out of a table and it will send this e-mail to each one of the e-mail addresses?
I know I can do it with a single one (use in HTML --> <a href="mailto:{emailaddress}?subject=Test&body=Body Test">Click here</a>
I would like to have this done automatically. I also created in my database a field and when the status is "True" / "Yes" / (check marked if you wish), it should only e-mail those people.
Searching the forum for many times I did found that I have to loop the records somehow.
Shortly said, I am so teriible lost with all this at the moment and am hoping someone is willing to help this newbie out with this issue...
To give you some info:
I use: CCS 3.1 / MS-Access / ASP
The connection/ database is called: WOR with the connection string:
Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Owner\Desktop\WORDB_Site\RUGS\Database\WOR.mdb;Persist Security Info=False
The e-mail addresses come out of the Table: "Members" and the field is called "emailaddress"
I also have a field in this Table, called "MailMe" (Boolean: True/False or Yes/No). This kind-of Where function ? (example mail all addresses Where MailMe=True and loop till end)
Anyone willing to look into this? I would be so greatfull!
|
 |
 |
Greg Martin
|
| Posted: 11/17/2006, 3:56 PM |
|
This is not really a CCS question but a scripting one, here is an example in sort of pseudo code that shows you how to move through a table in VBScript, and get the records you require, then call your function to email from the data and update.
I'm using the word "Emails" for everything, of course, you need to change to the appropriate database, table and field names.
<%
Dim adoCon 'Holds the Database Connection Object
Dim rsEmails 'Holds the e-mail record sets
Dim strSQL 'Holds the SQL to the recordset you want to retrieve
'**Open the database, you might use DSN or a direct approach to the database.
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("emails.mdb")
'**Create an object to hold the recordset
'**and use optimistic locking on the records
Set rsEmails = Server.CreateObject("ADODB.Recordset")
rsEmails.CursorType = 2
rsEmails.LockType = 3
'Create your SQL to get the records
strSQL = "SELECT tblEmails.EmailAddress, tblEmails.MailMe FROM tblEmails;"
'Open the recordset
rsEmails.Open strSQL, adoCon
'Go through the records and e-mail the people
Do While not rsEmails.EOF
YourEmailFunction(rsEmails("EmailAddress"),rsEmails("MailMe"))
rsEmails("MailMe") = WhatEverValueYouNeed
rsEmails.Update
rsEmails.MoveNext
Loop
'close everything and destroy the objects
rsEmails.Close
Set rsEmails = Nothing
Set adoCon = Nothing
%>
I would probably do an update with an ADO query, but that's up to you.
Hope this helps,
Greg
gmartin@microresource.co.uk
Software Consultant
www.microresource.co.uk
|
|
|
 |
flipandboef
Posts: 107
|
| Posted: 11/20/2006, 7:12 AM |
|
Thanks Greg,
I will try to play around with the informaion you gave me. Hopefully it will work out.
I'll let you know.
|
 |
 |
marcwolf
Posts: 361
|
| Posted: 11/20/2006, 7:08 PM |
|
Hi Flipandboef
I have recently had to do this for a client who was using MsAccess. They had a criteria where the emailing component was to be independant of other applications. As in he did not want to reply on Outlook or Notes.
There is a very nice component called AspEmail from Persits and you can download this for free. The full version adds some additional functionality but it not needed in this instance.
Here is the code I used
Dim oMailer As MailSender
Set oMailer = New MailSender
oMailer.Host = "smpt.somewhere.com"
oMailer.Port = 25
Do Until rsOrders.EOF
# your code to extract the fields from the record here!!!!
oMailer.AddAddress strRecip, strRecipName
oMailer.From = "MyApps.SomeWhere.Com"
oMailer.FromName = "My Application"
oMailer.Subject = strSubject
oMailer.Body = strBody
if len(strAttach) > 0 then
oMailer.AddAttachment strAttach
end if
oMailer.send
rsOrders.MoveNext
Loop
You can see from the above that it is a pretty simple task.
The above component is also perfect (and was designed for) sending Emails from a Web application
Hope this helps.
Dave
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
|
 |
 |
flipandboef
Posts: 107
|
| Posted: 11/22/2006, 8:55 AM |
|
Thanks all!
Don't aks how but i was able to combine pieces of both scripts and got it to work!
|
 |
 |
Kmgb
|
| Posted: 01/24/2007, 4:17 AM |
|
Lowest Prices on Quality Drugs
<a href="http://mountviewguesthouse.com/admin/images/1soma.html">Soma</a>
<a href="http://mountviewguesthouse.com/admin/images/2.html"></a>
|
|
|
 |
|