Forums

ASP

This topic is locked

Emailing a newsletter to members of DB...

Posted 25 Jul 2003 21:33:19
1
has voted
25 Jul 2003 21:33:19 Paul Boreham posted:
Could anyone please help!!

I'm trying to email a small newsletter (stored in an access DB) which is updated weekly to members of my site via .asp

The email addresses are also stored in an Access DB - I guess this is fairly easy, but I cannot figure it out.

BTW, I've not really ventured into the realms of CDONTS yet and it must be in ASP!

Anyone got any ideas please?!

Cheers, Paul

Replies

Replied 28 Jul 2003 00:09:00
28 Jul 2003 00:09:00 Lee Diggins replied:
Hi Paul

You'll need to create a recordset to get the newsletter e-mail addresses and any other data you require. You can then assign the recordset values to the variables in the cdonts code below:

<%
'#######################################################
'The structure is split into two sections
'1. Assigning the data
'2. Creating the e-mail
'#######################################################
'Section One - Assigning the data
'#######################################################

'Below you will create the 'body, subject, to, from, attach file, cc, bcc and
'Reply-To variables

Dim strBody, strSubject, strTo, strFrom, strAttFile, strCC, strBCC, strReplyTo

'Now you will assign the values to the variables declared above in the code
'below, de-comment the ones you want to use by removing the (') sign.
'You could set the values to request.form/querstring, recordset values etc..

'strBody =
'strSubject =
'strTo =
'strFrom =
'strAttFile =
'strCC =
'strBCC =
'strReplyTo =

'#######################################################
'Section Two - Creating the e-mail
'#######################################################

'You will now create the new e-mail object variable. I have called it objNewMail
'telling me its an object "obj" and it's a new e-mail "NewMail". You can call it
'anything you like, but let it make sense to you and others.

Dim objNewMail

'You will now create the "NewMail" object and assign the object to the variable
'dimmed above.

Set objNewMail = Server.CreateObject("CDONTS.NewMail"

'You will now assign the NewMail object property values by using the variables
'you created in Section One - Assigning the data. Don't forget to remove
'the (') sign from the ones you want to lose.
'The "'compulsory" lines are just that, these are the minimum you need
'to send an e-mail via cdonts, not much point without strBody - lol

'objNewMail.To = strTo 'compulsory
'objNewMail.CC = strCC
'objNewMail.BCC = strBCC
'objNewMail.From = strFrom 'compulsory
'objNewMail.Value("Reply-To" = strReplyTo
'objNewMail.Subject = strSubject
'objNewMail.Body = strBody
'objNewMail.BodyFormat = 1 '1 = text, 0 = html
'objNewMail.MailFormat = 1 '1 = text, 0 = MIME
'objNewMail.Importance = 1 '0 - low, 1 - medium or 2 - high
'objNewMail.AttachFile strAttFile
'objNewMail.Send 'compulsory

Set objNewMail = Nothing 'destroy the object

'#######################################################
'THE END <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
'#######################################################
%&gt;

Digga

Sharing Knowledge Saves Valuable Time!!!

Reply to this topic