Member Avatar for MarcusMaximus

We have an internal custom program in-house for CRM and we export all email address weekly for a mailer to another external program on our web server.

We currently receive emails and manually unsubscribe people from our email database weekly as they come in.

I would like to write a simple unsubscribe script that writes to an access database or text file that i can later import into our access based CRM. We have an IIS server available here but i've never used ASP before.

Member Avatar for MarcusMaximus

I found the following script that is supposed t owrite to a text file but i get an error back while testing.

<form method=post action=''>
<input type=text name=email><input type=submit value=Submit>
</form>
<%
Dim email
email = Request("email")
if len(email) > 2 Then 
Const Appending=8
Dim OpenFileobj, FSOobj,FilePath
FilePath=Server.MapPath("text.txt") ' located in the same directory 
Set FSOobj = Server.CreateObject("Scripting.FileSystemObject")
if FSOobj.fileExists(FilePath) Then 
Set OpenFileobj = FSOobj.OpenTextFile(FilePath, Appending)
OpenFileobj.WriteLine(email)
OpenFileobj.Close
Set OpenFileobj = Nothing
Else
Response.Write "File does not exist"
End if 
Set FSOobj = Nothing
End if 
%>

I get the following error

Microsoft VBScript runtime error '800a0046'

Permission denied

/newsletter/Removeasa.asp, line 13

Member Avatar for MarcusMaximus

It was a permissions issue. Had to allow everybody the ability to write to files in the specific folder.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.