SQL Guru Needed! |
Post Reply ![]() |
Author | |
kspare ![]() Senior Member ![]() Joined: 26 January 2005 Location: Canada Status: Offline Points: 334 |
![]() ![]() ![]() ![]() ![]() Posted: 21 October 2004 at 12:49am |
I came up with an idea, but I can't make it work because of my limited SQL knowledge. I want to create a script that will run once or twice a day that will generate an email to be send to my users to let them know there is a spam message addressed to them in the quaruntine. Can anyone help me with this? Kevin |
|
![]() |
|
Desperado ![]() Senior Member ![]() ![]() Joined: 27 January 2005 Location: United States Status: Offline Points: 1143 |
![]() ![]() ![]() ![]() ![]() |
Kevin, This can actually get semi complex but ... how familiar are you with stored procedures? You can write a procedure that gets all new blocked messages and use the SQL scheduler as the "trigger" for it. What you do from there depends on your person programming style. You can either have the procedure RE-WRITE a database table and use the addresses from there to generate massages or you can have the procedure overwrite an "flat file" for the same purpose. From there you can use CDO (Don't use CDONTS as it has been superceded and it will not work on 2003 server) to send out messages (my preference) or, I suppose you could actually use SpamFilter to send it out using the same methodology at the self registering ASP sample. Also, I believe someone wrote a VB app to do this and posted it somewhere. I haven't really looked at that though. Regards, Dan S. |
|
![]() |
|
kspare ![]() Senior Member ![]() Joined: 26 January 2005 Location: Canada Status: Offline Points: 334 |
![]() ![]() ![]() ![]() ![]() |
Hey Dan, as you know i'm not much of a programmer, but I can come up with great ideas :) Basically, what I would it to do is this. Count the # of spam for a user, and email them with a generic email to the counted email address, containing the email address mailed to, the number of spam counted and a link to where they can check the spam? can this be done easily? What I don't want is a spam sent out EACH time a spam enters the q. I want this to happen only twice a day. Maybe even onyl once a day. Kevin |
|
![]() |
|
Desperado ![]() Senior Member ![]() ![]() Joined: 27 January 2005 Location: United States Status: Offline Points: 1143 |
![]() ![]() ![]() ![]() ![]() |
Kevin, "can this be done easily?" I guess that depends on how you define "easily". I need to think about it some more. I will get back to you. However, I do not call myself a "Guru" ... more like a "Hack" Dan |
|
![]() |
|
kspare ![]() Senior Member ![]() Joined: 26 January 2005 Location: Canada Status: Offline Points: 334 |
![]() ![]() ![]() ![]() ![]() |
heh your one step ahead of me Dan! When you come up with some ideas, could you email me?
|
|
![]() |
|
Desperado ![]() Senior Member ![]() ![]() Joined: 27 January 2005 Location: United States Status: Offline Points: 1143 |
![]() ![]() ![]() ![]() ![]() |
No problem
Dan |
|
![]() |
|
Ric ![]() Guest Group ![]() |
![]() ![]() ![]() ![]() ![]() |
Kevin - I've had this working since I first started using SpamFilterISP. It's dependant on the Windows scheduler (on the SF server) to run one page(auto_notify.asp') in IE hourly during business hours, and a second page('auto_reminder.asp') at 6am each business day. I am not an ISP; I use SF at my business... so this will be different for those of you processing 100's of thousands of messages a day (server load to process these pages, script timeout, etc.)... we average under 10K messages daily. Some users are annoyed with messages throughout the day, and just want one reminder in the morning, so I gave them both options (some choose to have both). The morning reminder is limited (you can easily change this) to only notify those with more than 50 messages in the quarantine. I modified the 'tbllogins' table to add two fields - 'notify' and 'reminder'. (I'm using MySQL). They are both type 'bool' fields, defaulting to -1 (on). At the top of the 'listspam.asp' page I added: 'update the notification field for this user
At the bottom of the 'listspam.asp' page, I have added the following: SQL = "SELECT Notify FROM tblLogins WHERE (Email = '" & EmailTo & "')" The above code gives the users a 'toggle' to turn on and off their notification messages. Next, I have the following saved as 'auto_notify.asp': Set rs = con.Execute(SQL) response.write "<BR>" & X & " notification messages sent.<br><br><br>" & vbCRLF Thew following is saved as 'auto_reminder.asp': |
|
![]() |
|
Ric Marques ![]() Guest Group ![]() |
![]() ![]() ![]() ![]() ![]() |
OOPS! overflowed.... didn't realize there was a limit to length of posts... Here's the rest:
The following is saved as 'auto_reminder.asp': SUB SendMessage(strEmail, lMessageCount) It's not the cleanest code, I just hacked it together... but I hope this gives you some ideas to help you with your quest. Ric Marques |
|
![]() |
|
kspare ![]() Senior Member ![]() Joined: 26 January 2005 Location: Canada Status: Offline Points: 334 |
![]() ![]() ![]() ![]() ![]() |
Wow, thanks for the quick reply! Just so I understand this, the auto-notify only sends to people who switch this option on, and autoreminder sends to everyone in the database? |
|
![]() |
|
Ric Marques ![]() Guest Group ![]() |
![]() ![]() ![]() ![]() ![]() |
Kevin If you set both of the new fields (reminder and notify) in the tbllogins table to default to -1, then both messages will automatically be sent. The toggles at the bottom of the listspam page let the users control if they get the messages or not. You can take away the toggle for the reminder message so that they can't turn it off if you'd like. -Ric |
|
![]() |
|
kspare ![]() Senior Member ![]() Joined: 26 January 2005 Location: Canada Status: Offline Points: 334 |
![]() ![]() ![]() ![]() ![]() |
Well, i'm playing around with the code, I do want to allow people who have setup an account in spamfilter to turn off notification, right now i'm just playing around with trying to get the web code working so they can turn it on and off lol |
|
![]() |
|
kspare ![]() Senior Member ![]() Joined: 26 January 2005 Location: Canada Status: Offline Points: 334 |
![]() ![]() ![]() ![]() ![]() |
Well. I'm looking through this, Great Idea. I just gotta figure out how to make this work with MS-SQL!! lol
|
|
![]() |
|
kspare ![]() Senior Member ![]() Joined: 26 January 2005 Location: Canada Status: Offline Points: 334 |
![]() ![]() ![]() ![]() ![]() |
Hey Ric, when you get a chance, can you fire me an email to kevin@pare.ca so I can talk to you about this code? The logic is perfect, I just can't get it to work!
Kevin |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
This page was generated in 0.211 seconds.