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

Processing unsubscribe requests to a mailing list

Status
Not open for further replies.

vidyaR

Programmer
Jul 14, 2001
5
US
Hi,
I want to set up a mailing address for users to send mail to when they want to unsubscribe from a mailing list and I want to automate the processing of the emails.
Can this be done using ColdFusion? Any clues that'll point me in the right direction would be appreciated.

thanks,
-vidyaR
 
it depends on how the SUBSCRIBE system is set ;]]
i don't know about email processing, but if you're not stuck with this and/or are in a hurry, what you can do is simply make the user go to a certain url to unsubscribe - this is done quite often
and then that url is only sending a query to delete the user's records in the db - quite easy with coldfusion
let me know if it helps, or if you wnated an "only email" solution
 
hi vidyaR

Make sure that the reply to address is correct, and ask users to put the word unsubscribe in the subject.

Setup a scheduled task to run checkmail.cfm every 5 or 10 minutes. Checkmail.cfm should get all mail from the account in question, say listserv@yoursite.com. It should then loop through all of the messages returned, and check if the word unsubscribe exists in the subject. If it does, run a query to delete from or deactivate the record of your email list table where the email address matches that of the current message. The final command in the loop should be to delete the message from the server, if you want to clean it up.

Try this:

<CFPOP
server=&quot;mail.yoursite.com&quot;
username=&quot;listserv&quot;
password=&quot;xx&quot;
action=&quot;getheaderonly&quot;
name=&quot;getmail&quot;>

<CFLOOP query=&quot;getmail&quot;>
<CFSET temp.msgnum = messagenumber>
<CFSET temp.subject = trim(subject)>
<CFSET temp.email = from>

<CFIF ucase(temp.subject) contains ucase(&quot;unsubscribe&quot;)>
<CFQUERY name=&quot;updEmailList&quot; datasource=&quot;ds1&quot;>
update emaillist
set active = false
where upper(email) = '#ucase(from)#'
</CFQUERY>
</CFIF>
<!--- delete if you want
<CFPOP
server=&quot;mail.yoursite.com&quot;
username=&quot;listserv&quot;
password=&quot;xx&quot;
action=&quot;delete&quot;
messagenumber=&quot;#temp.msgnum#&quot;>
--->
</CFLOOP>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top