Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 22,712 times

Contents

Downloads

Related Categories

Creating a Newsletter system - Sending the newsletter

PVarando

Sending the newsletter

Finally, we need to create a page to send newsletter:

SendNewsletter.cfm

<CFIF IsDefined("Message")>

<CFQUERY NAME="GetMembers" DATASOURCE="Your DSN">
Select *
From Newsletter
<CFIF Form.EmailType EQ "1">
WHERE EmailType = 1
<CFELSE>
WHERE EmailType = 0
</CFIF>
Order By MemberID
</CFQUERY>


<CFLOOP QUERY="GetMembers">
<!--- Determine if email going out will be in HTML format or not --->
<CFIF #Form.EmailType# EQ "1">
<CFMAIL To="#GetMembers.Email#"
From="newsletter@menofvisionent.com"
Subject="This Week's Newsletter!">
#GetMembers.Message#
Sent: #DateFormat(Now(), 'ddd. mmmm dd, yyyy')#
to Unsubcribe visit: http://www.menofvisionent.com/unsubscribe.cfm
</CFMAIL>
<CFELSE>
<CFMAIL To="#GetMembers.Email#"
From="newsletter@menofvisionent.com"
Subject="This Week's Newsletter!"
type="HTML">
#GetMembers.Message#
Sent: #DateFormat(Now(), 'ddd. mmmm dd, yyyy')#
to Unsubcribe visit: http://www.menofvisionent.com/unsubscribe.cfm
</CFMAIL>
</CFIF>
</CFLOOP>


<CFELSE>
<form action="sendnewsletter.cfm" method="post">
The Message: <Textarea Name="Message"></textarea><BR>
Send as:
Text <input type="Radio" name="EmailType" value="1">
HTML <input type="Radio" name="EmailType" value="0"><br>
<input type="Submit" Value="Mail Newsletter">
</FORM>
</CFIF>

That's it! You've now created a fully interactive newsletter system for your site!

I've been around computers ever since I could remember, The first time I toyed around with a computer, I was about 3 years old. I ran my own BBS service in Miami from age 7 to 13 and I found it very interesting. The internet then began to emerge and that's part of the reason I stopped the BBS access. I've been creating web sites for over 6 years. Before then I was building and repairing computers for fun and profit. I was born in Buenos Aires, Argentina on February 20th, 1978. You can learn a little more about me and my family by visiting my personal home page. I enjoy programming and designing graphics using programs such as Photoshop, Paint Shop Pro, and Bryce. I've enjoyed many different types of computer jobs, but web development is my absolute favorite. I enjoy building a web site and seeing it evolve into a full living site. I say living because that's how I look at a site, if you don't nurture it, maintain it, and from time to time re-dress it, it grows cold and eventually dies. Now that you know a little about me, let me hear from you, you can contact me at: webmaster@cfm-resources.net

Get FREE ColdFusion Hosting at: http://www.cfm-resources.com

Comments

  • Re: [1948] Creating a Newsletter system

    Posted by Jbuda on 23 May 2006

    Try using 'GTE' as opposed to 'GTI'.

    Its supposed to mean Greater Than or Equal to.

  • Re: [1948] Creating a Newsletter system

    Posted by 7vinyls on 13 May 2006

    Hi, could anyone help me with this? Im getting an error on the unsubscribe page to do with the GTI line. Its pretty new to me and im not even sure what this line means!!!



  • quick question

    Posted by cralph on 22 Jan 2003

    I'm new to the web scene but need this script to work. Please let me know how I put it in. Is it in the body. Are they seperate pages?
    Can you make this dummy proof for a beginner like me.

    Thanks ...

  • questions on newsletters

    Posted by ak11 on 14 Jan 2003

    Hi i am new in creating newsletters and i would like to ask you.This code you submit enters in the section.I tried to put it there but in the PREVIEW i see nothiing but plain text.
    Plea...

  • RE: Message variable error

    Posted by psfong on 11 Jul 2002

    If you have notice, the sample code here does not have a field 'message' in the database. Maybe you can add in the field for 'message', or you can have a form before that to input all the email messag...