Small mod: Blocking forum email spam

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/62640?pagenum=1
04 November 2025, 10:47

Topic


ruirib
Small mod: Blocking forum email spam
25 August 2006, 07:09


Version 1.01 - 2006/08/25
Snitz forum version: 3.4.05

This mod will stop members emailing other forum members until they reach a given number of forum posts. It's useful to stop spammers who register just to send emails to forum members.
It's not a very elaborate mod, and the post limit must be changed in the code, but I'm providing it because with the current surge of spammers registering all over the place, it can be useful to avoid them annoying your valuable forum members.
It's even more interesting because it will allow the spammer to write the email and when the email is sent, it will show a message stating that it won't be sent, since the member does not have the required number of posts to send it. So, they'll have the trouble to compose the message only to be told it can't be sent, once that is tried. It will also send a message to the forum admin, notifying him of the spam attempt, so that the member can be blocked.
Code changes to an unchanged pop_mail.asp: Starting with a pop_mail.asp, at line# 46, add the following code:
Code:

'######## Email Spam Mod ############

if Request.QueryString("mode") = "DoIt" then
Err_Msg = ""

strSql = "SELECT M_NAME, M_POSTS FROM " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE M.MEMBER_ID = " & MemberID

set rs = my_Conn.Execute (strSql)

If Not rs.EOF then
intMPosts = rs("M_POSTS")

if intMPosts < 10 then
Err_Msg = "<li>You don't have enough posts to email other members.</li>"
strSpammerName = RS("M_NAME")

'Send email to forum admin
strRecipients = strSender
strFrom = strSender
strFromName = "Automatic Server Email"
strSubject = "Possible Spam Poster"
strMessage = "There is a possible spam poster at " & strForumTitle & vbNewLine & vbNewLine
strMessage = strMessage & "Member " & strSpammerName & ", with MemberID " & MemberID & ", has been trying to send emails to " & Request.Form("Name") & ", without having enough posts to be allowed to do it." & vbNewLine & vbNewLine
strMessage = strMessage & "Here are the message contents: " & VbNewLine & Request.Form("Msg") & vbNewLine & vbNewLine & vbNewLine & vbNewLine
strMessage = strMessage & "This is a message sent automatically by the Spam Control Mod ;)."

%>
<!--#INCLUDE FILE="inc_mail.asp" -->
<%


end If

End if

rs.Close
end if
'############# End of email spam mod #############

Then at line# 102, where you have
Code:

if Request.QueryString("mode") = "DoIt" then
Err_Msg = ""
comment the 2nd line, so that it will look like this:
Code:

if Request.QueryString("mode") = "DoIt" then
'Err_Msg = ""
The commented line can also be removed, of course.
This has been tested with 3.4.05 and has been working well. If you need to change the number of messages a member must have before emailing other members, just change the number in red to the desired value.
If you need help with this, please post in the mod implementation forum. <

 

Replies ...


Nertz
25 August 2006, 08:01


Excellent Rui, thanks! Great timing too... I was trying to find time to do something like this.
cheers,
Nat<
ruirib
25 August 2006, 09:35


You're welcome smile.<
borge
25 August 2006, 14:11


It's not working on my 3.4.03<
AnonJr
25 August 2006, 14:16


What specifically is the problem/error?<
borge
25 August 2006, 14:23


I do not get any error message, it just ignores the mod and lets me post with a 0 post count

The 100 characters mod worked fine though<
borge
25 August 2006, 14:28


It is actually not sending the possible spam e-mail, and gives a notice "E-mail has been sent". It fails to display the "You don't have enough posts to email other members" message, but does the job and sends the spam. It sends a waring to forum admin about possible spam.<
AnonJr
25 August 2006, 14:41


hmm.. I wonder if there is a problem with the two working together; I wouldn't think so though. I almost think thats even better - let the spammer's think the e-mail was sent when it wasn't. The only problem is that it hurts the real members who want to send an email with fewer than the required posts since it does tell them it went through when it actually didn't. =/

Edit: you had to go and edit it while I was typing a reply! evil So it is sending the e-mail?<
borge
25 August 2006, 14:50


Yes, sorry, I notised the e-mails came in with a little delay. It is actually sending the e-mails, however I should probably say the messages were sent to a forum moderator account, hmmm...would it make a difference when sent to an ordinary member? I'll have to do more testing.<
ruirib
25 August 2006, 14:58


You can change the destination email by changing this line:
Code:

strRecipients = strSender
to
Code:

strRecipients = "whateverAddressYou@whish.com"
If it says the email was sent, then it was. Want to post a link to a text version of your pop_mail.asp file?<
AnonJr
25 August 2006, 15:00


The code rui posted looks like it doesn't care who is sending it or to whom it is going... I suspect it won't make a difference. Then again, I haven't really played with pop_mail.asp too much either...
Maybe a txt version of pop_mail.asp and inc_mail.asp would help...
Edit: rui, you beat me again. sleepy<
ruirib
25 August 2006, 15:02


Originally posted by AnonJr
The code rui posted looks like it doesn't care who is sending it or to whom it is going...
Edit: rui, you beat me again. sleepy

Quite so... in both counts smile.<
ruirib
25 August 2006, 15:34


You have an error in pop_mail.asp. Where now you have this at line# 77
Code:

else
intMemberID = 0
end if
You should cut these lines and move them to around line number# 47, so that the code, starting at line# 46 looks like this:
Code:

if Request.QueryString("ID") <> "" and IsNumeric(Request.QueryString("ID")) = True then
intMemberID = cLng(Request.QueryString("ID"))
else
intMemberID = 0
end if
'######## Email Spam Mod ############
<
borge
25 August 2006, 15:52


Fixed the code as suggested but still it is not working. I updated the txt file too if you like to check.<
ruirib
25 August 2006, 16:13


Instructions updated to add a new required code change, regarding line# 102.<
borge
25 August 2006, 17:59


It works now bigsmile Thanks!!!<
ruirib
25 August 2006, 18:30


You're welcome.<
Mr Pink
26 August 2006, 06:02


Thank you Rui, this is an excellent mod smile It's so simple that it's brilliant!<
ruirib
26 August 2006, 09:39


Glad to be of help, Martin smile.<
richfed
26 August 2006, 12:41


Nice! Thanks, ruirib!<
tomfassett
27 August 2006, 12:59


Ignorant question here--I assume that it does not matter what the line numbers are as long as I change the proper coding (trying to get my head around VB language here blush). The line you refer to as 102 in an unmodified pop_mail.asp file is actually line 65 in mine (and the only instance of this particular command).
Also, in my file line 46 is the middle of an "if then" statement and I assume this would be a bad place to insert the modified code. Since your line number is low, I assume this should be near the beginning of the file. In my pop_mail.asp file, line 50 is the end of the code which checks to make sure the emailer is a member. Here is the section I am talking about:
if Request.QueryString("ID") <> "" and IsNumeric(Request.QueryString("ID")) = True then
intMemberID = cLng(Request.QueryString("ID"))
else
intMemberID = 0
end if

Should the mod code be placed right after this or is there more that needs to be done before the mod is used?
Tom F
<
ruirib
27 August 2006, 13:07


It should be placed right after that code.<
Panhandler
27 August 2006, 23:02


Could a similar mod be designed for Private Forums? Meaning, any member could access the Private Forum if they had a post count of more than ten?
<
ruirib
28 August 2006, 02:35


It's a different thing completely and should not be done this way, but it can be written.<
borge
04 September 2006, 05:29


This mod really works great. After using it for a while I have some suggestions for additional functionallity.

Would it be possible to add a function which will hold mail rather then stopping them. What I am thinking is a function who will keep mail pending from members which does not have the required number of posts to send, then enableing the forum admin to approve pending mail to be sent.
Alternatively an option which will enable the forum admin to approve "send mail" for members before reaching the required number of posts to send<
Podge
04 September 2006, 05:35


As admin all you have to do is edit the member and increase their post count to allow them to send email.<
ruirib
05 September 2006, 16:23


Originally posted by borge
This mod really works great. After using it for a while I have some suggestions for additional functionallity.

Would it be possible to add a function which will hold mail rather then stopping them. What I am thinking is a function who will keep mail pending from members which does not have the required number of posts to send, then enableing the forum admin to approve pending mail to be sent.
Alternatively an option which will enable the forum admin to approve "send mail" for members before reaching the required number of posts to send

Hi,

I can understand the request, but what you ask would add some complexity to the mod. A database structure would be needed to save queued messages and then you'd need to add functionality to manage the queue. The functionality makes sense, but this was thought to be a quick, effective way to handle the most blatant spammers. Maybe I or someone else can improve this in the future.<
borge
05 September 2006, 16:29


Yes, I realize it will be quite a bit of work. Wish I was skilled enough in programming to help out. You are all doing such a great job here! I'll keep an eye on this mod to see if anyone feels tempted to take on the job in the future smile<
MarcelG
07 September 2006, 07:53


Implemented this one in 2 minutes. Thanks Rui, this one is a breeze!!! bigsmile<
HuwR
07 September 2006, 08:00


borge,

to accomplish this bit
Alternatively an option which will enable the forum admin to approve "send mail" for members before reaching the required number of posts to send
The admin can just increase the members post count manually to allow them to send mail<
ruirib
07 September 2006, 09:20


Originally posted by MarcelG
Implemented this one in 2 minutes. Thanks Rui, this one is a breeze!!! bigsmile
You're welcome Marcel.<
borge
09 September 2006, 03:43


Alternatively an option which will enable the forum admin to approve "send mail" for members before reaching the required number of posts to send
The admin can just increase the members post count manually to allow them to send mail
Thanks Huwr, I realized I could do it that way, but I don't like it, as it will look as if the member posted a number of posts which he did not. Anyway, I have included some text in the error message, telling those without posting permission that they may forward their email to the webmaster and ask for it to be forwarded on to the other member. It calms people down a bit bigsmile<
nickw
11 September 2006, 05:40


Ruirib,

I wanted to thank you for this "quick" mod. Works well, and stops the muppets. Appreciate it.<
ruirib
11 September 2006, 07:20


You're welcome Nick smile.<
Desmomax
18 September 2006, 08:23


great mod! works fine!!! is it possible to do same with private messages? 10x
<
ruirib
18 September 2006, 08:51


Well I guess it could be done with the PM mod, I just never looked at it. Maybe post a request for that in the Mod W/O code forum.<
Desmomax
18 September 2006, 09:28


done.. many thanx

i think could be usefull.. expecially to stimulate users partecipating the forum<
Podge
18 September 2006, 10:05


I added this mod two days ago. Within 24 hours someone registered and sent advance fee fraud pm's to all of my members.<
Classicmotorcycling
08 October 2006, 05:15


I have altered the code to work with PM's as well:
Originally posted by Desmomax
great mod! works fine!!! is it possible to do same with private messages? 10x
Here is the code to put in to privatesend_info.asp:
Code:
	    			strPMNID = rsName("MEMBER_ID")
strPMRecv = rsName("M_PMRECEIVE")
strPMNEmail = rsName("M_PMEMAIL")

'######## Private Message Spam Mod ############
strSql = "SELECT M_NAME, M_POSTS FROM " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE M.MEMBER_ID = " & MemberID
set rs = my_Conn.Execute (strSql)

If Not rs.EOF then
intMPosts = rs("M_POSTS")

Dim strSpamMin
strSpamMin = "10"

if intMPosts < 10 then
strErrMessage = "<li>You have not posted at least " & strSpamMin & " messages to be able to Private Message other members.</li>"
strSpammerName = RS("M_NAME")

'Send email to forum admin
strRecipients = strSender
strFrom = strForumTitle & " <" & strSender & ">"
strSubject = "Possible Private Message Spam Poster"
strMessage = "There is a possible spam poster at " & strForumTitle & vbNewLine & vbNewLine
strMessage = strMessage & "Member " & strSpammerName & ", with MemberID " & MemberID & ", has been trying to send Private Messages to " & Request.Form("sendto") & ", without having the required " & strSpamMin & " posts to be allowed to Private Message other users." & vbNewLine & vbNewLine
strMessage = strMessage & "Here are the message contents: " & VbNewLine & Request.Form("Msg") & vbNewLine & vbNewLine & vbNewLine & vbNewLine
strMessage = strMessage & "This is a message sent automatically by " & strForumTitle & "."
%>
<!--#INCLUDE FILE="inc_mail.asp" -->
<%
boolSend = false
end If
end if
rs.Close
'############# End of Private Message Spam Mod #############
if strPMRecv = "0" then
strErrMessage = strErrMessage & "Sorry, " & arrNames(i) & " does not wish to receive private messages"
boolSend = false
end if
end if
Just add the code in blue and put it in between the red code.
I hope that helps. wink<
ruirib
08 October 2006, 05:26


David, just a thought... Maybe the spammer should not know how many messages he needs to post before being able to PM other members. Otherwise he may post bogus messages just to hit the minimum...<
Classicmotorcycling
08 October 2006, 06:23


I thought of that as well, but it is good that they know as I monitor the first few posts of a new user to make sure that they are not spammers and will delete their account straight away.<
borge
17 October 2006, 02:34


I have just experienced that a "Nigeria" spammer managed to get 3 messages through to another member without having the aquired number of posts (he did not have any forum posts). 4 other messages were stopped, and I locked his account as soon as I received the first warnings of a possible spam poster.<
sergiomura
25 October 2006, 15:40


Hi! I'm Sergio from Italy. This mod is really beautiful, but we must consider that many of us use a pop-up box to send and receive the mp. So the code must change for use in pm_send_info.asp
Is it possible?
Sergio<
Classicmotorcycling
25 October 2006, 16:48


Sergio,

It is possible, but as pm_send_info.asp is not a part of the PM system I have, then I have no idea on what version of PM you areusing.
Originally posted by sergiomura
Hi! I'm Sergio from Italy. This mod is really beautiful, but we must consider that many of us use a pop-up box to send and receive the mp. So the code must change for use in pm_send_info.asp
Is it possible?
Sergio
Post a link to a text version of your pm_send_info.asp and I will see what I can do for you. <
AnonJr
17 November 2006, 08:59


Just a thought I was discussing with the owner of one of the sites I maintain, why not just limit the number of e-mails a non-admin can send to something like 10? I mean, who the hell needs to send an e-mail to more than 10 people in a day on a forum? Maybe have some sort of an alert sent to the admin if they exceed this...
Just a thought.
JohnC, it doesn't take long for someone to click the "Email Poster" link and Ctrl+V the text and click "send"... Having said that, the idea of adding a time limit does sound promising. Maybe there's a way to tie it into the existing function for posting.<
JohnC
28 February 2007, 10:22


Thought I would share this mod to a mod. I wanted to keep track of spammer's IP addresses so I just added the following line (in red) to write the IP address in the email that goes to forum admin:

Code:
strMessage = strMessage & "Here are the message contents: " & VbNewLine & Request.Form("Msg") & vbNewLine & vbNewLine & vbNewLine & vbNewLine
strMessage = strMessage & Request.ServerVariables("remote_addr") & " " & Now() & "Server Time" & vbNewline strMessage = strMessage & "This is a message sent automatically by the Spam Control Mod ;)."
Hope you find it useful! smile<
JohnC
27 March 2007, 10:30


I upgraded to the latest version of Snitz (3.4.06) and now this mod no longer works. I get the following error:
Code:
error '8004020f'

/forums/inc_mail.asp, line 142
Anyone find a cure yet?<
ruirib
27 March 2007, 11:11


I think this was made to 3.4.06... not sure though. Better post a link to a text version of your inc_mail.asp.<
ruirib
27 March 2007, 11:18


You may also want to check this: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=61514&whichpage=2&SearchTerms=inc_mail.asp,142<
JohnC
27 March 2007, 11:39


Thanks for your responses, Rui. The start of this topic says "Version 1.01 - 2006/08/25, Snitz forum version: 3.4.05" posted by some guy named Rui. bigsmile
All of our other email functions are working fine.
Line 142 of inc_mail.asp is "objNewMail.Send"<
ruirib
27 March 2007, 12:18


John, please post a text version of the file. That's a weird error, though, cause I don't think the code added changed anything the could cause that.<
JohnC
27 March 2007, 12:25


Code:
if trim(strFromName) = "" then
strFromName = strForumTitle
end if

case "cdosys"
Set iConf = Server.CreateObject ("CDO.Configuration")
Set Flds = iConf.Fields

'Set and update fields properties
Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'cdoSendUsingPort
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strMailServer
Flds("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'cdoBasic
Flds("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxxx@xxxx.xxx"
Flds("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxxxx"
Flds.Update

Set objNewMail = Server.CreateObject("CDO.Message")
Set objNewMail.Configuration = iConf

'Format and send message
Err.Clear

objNewMail.To = strRecipients
objNewMail.From = strSender
objNewMail.Subject = strSubject
objNewMail.TextBody = strMessage
On Error goto 0 'Resume Next
objNewMail.Send
If Err <> 0 Then
Err_Msg = Err_Msg & "<li>Your request was not sent due to the following error: " & Err.Description & "</li>"
End if

Set objNewMail = Nothing

on error goto 0
%>
<
ruirib
27 March 2007, 12:36


John, can you save your current version of the pop_mail.asp, use the default Snitz 3.4.06 one and check whether it causes the same error or not?
I suspect it will, and I suspect the reason for the error may be the reason given here: http://classicasp.aspfaq.com/email/why-does-cdo-message-give-me-8004020f-errors.html

I think it may have to do with relaying, but if it is, then the normal, unchanged code will fail too.<
JohnC
27 March 2007, 13:15


My .05 version pop_mail.asp works fine with this mod and my .06 version does not.
Update: Tried 1 (cdoSendUsingPickup) in sendusing and get this error: "The pickup directory path is required and was not specified."

Update: Added:
Code:
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
Now I don't get any errors but also don't get any email. Why would there be so much of a difference between versions? Both version are on the same server.
Update: Went back to 2 (cdoSendUsingPort) and now it works on the new version as well.<
ruirib
27 March 2007, 16:23


Ok, glad it's working now. I suspected it wasn't related to the mod.<
daveo
29 March 2007, 11:09


I implemented the original version of the mod as posted with .06 and it works great. Too 10 minutes and fixed a problem I just had occur.<
ruirib
29 March 2007, 11:14


Originally posted by daveo
I implemented the original version of the mod as posted with .06 and it works great. Too 10 minutes and fixed a problem I just had occur.
Yes, that should be the case. The previous issue was related to server authentication, not to the mod.<
matko
28 May 2007, 09:44


Rurib,

thank you for this mod, it is very useful for me, however I need it for other reason than prevent spammers. I am running forum dealing with catholic religion and spirituality and I have come across problem, that some users from different sects are registering, just to be able to reach other users by mail in effort to convert them. Until I know who the new user is, I don't want to let him/her to send e-mail to others. For this limiting by post count would work just fine, but some users come by recommendation from senior members and I would like to allow them e-mail immidiately.
I have some experience in programming asp (not professional), however I don't fully understand forum code and variables used so I was thinking of small improvement of your mod, just to add one more field in MEMBERS table, lets say M_ALLOWEMAIL yes/no and modify your code accordingly.
I am not sure if this is the right forum for this, but my idea is to try to modify your code and in case I don't understand something to ask you for little explanation. Whould it be acceptable for you?<
ruirib
28 May 2007, 10:28


Sure, I'll be here to help if you need.<
bobby131313
28 May 2007, 11:24


small improvement of your mod, just to add one more field in MEMBERS table, lets say M_ALLOWEMAIL yes/no and modify your code accordingly.

I just manually increase their post count so they can email. Since I'm the boss, I can do that. cool Please don't tell my wife I said that. blackeye

<
matko
28 May 2007, 11:46


I think simple modification of your code will do. This code is supposed to look into database if member is allowed to send e-mail independently of post count:
Code:

strSql = "SELECT M_NAME, M_POSTS, M_ALLOWEMAIL  FROM " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE M.MEMBER_ID = " & MemberID

set rs = my_Conn.Execute (strSql)

If Not rs.EOF then
intMPosts = rs("M_POSTS")
intAllowEmail = rs("M_ALLOWEMAIL")
if intMPosts < 10 and intAllowEmail="0" then


Now I need to do two things:
1. Find a tutorial how to write dbs_ modification file.I mean syntax how to add one column into existing table with default value of 1
Any suggestion, where can I read about it? I tried to "reverse engineer" it from dbs_ files I have, will this work?
Code:

[ALTER]
MEMBERS
ADD#M_ALLOWEMAIL#INT#NULL#1
[END]
What exactly is the NULL statement for? I need to create column with value 1 for existing records, but 0 for new records.
2. modify pop_profile.asp to allow admin to change e-mail status of user from disallowed to allowed.<
ruirib
28 May 2007, 17:27


The code change seems ok. A reference on dbs files is here: http://forum.snitz.com/forum/topic.asp?ARCHIVE=true&TOPIC_ID=5120


You should create the column with the desired default value (0) and then use a small dbs script to set the value to 1 for the existing records.<
matko
29 May 2007, 01:33


Thanks rurib, that was exactly what I was looking for. So next step should be
Code:

[ALTER]
MEMBERS
ADD#M_ALLOWEMAIL#SMALLINT##0
[END]
[UPDATE] MEMBERS
M_ALLOWEMAIL#1#
[END]
[ALTER] MEMBERS_PENDING
ADD#M_ALLOWEMAIL#SMALLINT##0
[END]
[UPDATE] MEMBERS_PENDING
M_ALLOWEMAIL#1#
[END]

Let's move to thrid step, probably the most difficult.
Where can I find what user levels are stored in mLev variable? I am only guessing from the code that mLev = 0 means not logged in, mLev =1 means common user, mLev = 4 admin?<
ruirib
29 May 2007, 03:33


You need to start using the search feature, most your questions could be answered through it...
Anyway, here it goes: 1 = Member, 2 = Post Author, 3 = Moderator, 4 = Admin<
matko
29 May 2007, 04:17


Sorry about that, somehow I didn't put the correct key words to get my answers. blush I'll try harder next time, before I ask.<
matko
29 May 2007, 11:20


Ok, I think I have finished this, there are only three relatively simple changes needed. 1. In unmodified pop_profile.asp look for this code (around 969)
Code:

strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_QUOTE"
strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_BIO"
strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_SIG"

and right BELOW these lines add this code
Code:
strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_ALLOWEMAIL"

So it looks like this
Code:

strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_BIO"
strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_SIG"
strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_ALLOWEMAIL" strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS"

2. In the same pop_profile.asp look for this (around 1586):
Code:
if strBio = "1" then
strSql = strSql & ", M_BIO = '" & chkString(Request.Form("Bio"),"message") & "'"
end if

and right BELOW these lines add this:
Code:
strSQL = strSql & ", M_ALLOWEMAIL = " & cLng(Request.Form("allowemail"))

so it looks like this
Code:
if strBio = "1" then
strSql = strSql & ", M_BIO = '" & chkString(Request.Form("Bio"),"message") & "'"
end if
strSQL = strSql & ", M_ALLOWEMAIL = " & cLng(Request.Form("allowemail")) strSql = strSql & " WHERE MEMBER_ID = " & cLng(Request.Form("MEMBER_ID"))

my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords

3. in inc_profile.asp look for this code (around 532)
Code:

     if rs("M_LEVEL") = 3 then Response.Write(" selected")
Response.Write ">Administrator</option>" & vbNewLine & _
" </select>" & vbNewLine
end if
Response.Write " </td>" & vbNewLine & _
" </tr>" & vbNewLine

and right BELOW this add this code
Code:

response.write "                    <tr>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ align=""right"" valign=""middle"" nowrap><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>User allowed to send<br />e-mail before limit of <br />posts is reached? </font></b></td>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ valign=""bottom"">" & vbNewLine
response.write " <select name=""allowemail"">" & vbNewLine & _
" <option value=""1"""
if rs("M_ALLOWEMAIL")="1" then Response.Write(" selected")
Response.Write ">Yes</option>" & vbNewLine & _
" <option value=""0"""
if rs("M_ALLOWEMAIL")="0" then Response.Write(" selected")
Response.Write ">No</option>" & vbNewLine & _
" </select>" & vbNewLine
Response.Write " </td>" & vbNewLine & _
" </tr>" & vbNewLine

so it looks like this
Code:

        if rs("M_LEVEL") = 3 then Response.Write(" selected")
Response.Write ">Administrator</option>" & vbNewLine & _
" </select>" & vbNewLine
end if
Response.Write " </td>" & vbNewLine & _
" </tr>" & vbNewLine
response.write " <tr>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ align=""right"" valign=""middle"" nowrap><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>User allowed to send<br />e-mail before limit of <br />posts is reached? </font></b></td>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ valign=""bottom"">" & vbNewLine
response.write " <select name=""allowemail"">" & vbNewLine & _
" <option value=""1"""
if rs("M_ALLOWEMAIL")="1" then Response.Write(" selected")
Response.Write ">Yes</option>" & vbNewLine & _
" <option value=""0"""
if rs("M_ALLOWEMAIL")="0" then Response.Write(" selected")
Response.Write ">No</option>" & vbNewLine & _
" </select>" & vbNewLine
Response.Write " </td>" & vbNewLine & _
" </tr>" & vbNewLine


end if
if not(strUseExtendedProfile) then

My only question now is, what will happen if a new user will register? Will the M_ALLOWEMAIL value be set automatically do default value, or is there any other code change needed?<
ruirib
29 May 2007, 13:50


The default value for M_ALLOWEMAIL is 0, so new users will have the value set to 0.<
matko
30 May 2007, 04:31


In that case work is finished, I modified the code on my forum and I can prove that on Access it's working properly and it is also compatible with all mods that are part of Image's modification.
Is it worth to put this as a separate topic or is it enough if we leave it here?<
ruirib
30 May 2007, 05:05


You can start a new topic, in the Mod W/Code forum and present the whole code for the changes there.<
gpspassion
13 November 2007, 03:28


Excellent MOD, I added the IP line too !<
kmac
13 November 2007, 07:45


Kudos on the mail spam mod, and also the PM variant!
I don't know if I missed something, but I have a small glitch in the "Possible Spam Poster" email sent to the forum admin. It doesn't include the spam target's name. The output is this -
....... There is a possible spam poster at Blue Moon Fabrications - forum

Member bluemoonie1, with MemberID 468, has been trying to send emails to , without having enough posts to be allowed to do it.
Here are the message contents:
spam test
.........
Line 69, in pop_mail.asp reads -
........... strMessage = strMessage & "Member " & strSpammerName & ", with MemberID " & MemberID & ", has been trying to send emails to " & Request.Form("Name") & ", without having enough posts to be allowed to do it."
..............
Can I include the target's name in the email?


I also noticed, in the PM mod, that I wasn't getting the spammer's message in in the admin email. It worked when I changed Msg to Message

before - "Here are the message contents: " & VbNewLine & Request.Form("Msg")

after - "Here are the message contents: " & VbNewLine & Request.Form("Message")


Thanks, Ken<
ruirib
13 November 2007, 08:00


Can you post a link to a text version of your pop_mail.asp?<
kmac
13 November 2007, 08:04


Thanks for looking!
http://www.bluemoonfabrications.com/pop_mail.txt<
ruirib
13 November 2007, 08:42


The mod was written for Snitz 3.4.05. Snitz 3.4.06 changed pop_mail.asp and it does not include some form fields that were available with Snitz 3.4.05. Getting the destination member name will require another DB query. Here is the code for the initial mod part, required to have it working with 3.4.06:
Code:

'######## Email Spam Mod ############

if Request.QueryString("mode") = "DoIt" then
Err_Msg = ""

strSql = "SELECT M_NAME, M_POSTS FROM " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE M.MEMBER_ID = " & MemberID

set rs = my_Conn.Execute (strSql)

If Not rs.EOF then
intMPosts = rs("M_POSTS")

if intMPosts < 5 then
Err_Msg = "<li>You don't have enough posts to email other members.<br>If you feel that you have received this message in error, please contact the forum administrator.</li>"
strSpammerName = RS("M_NAME")

rs.Close


strSql = "SELECT M.M_NAME FROM " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE M.MEMBER_ID = " & intMemberID

set rs = my_Conn.Execute (strSql)

if rs.bof or rs.eof Then
strDestName = ""
Else
strDestname = rs("M_NAME")
End If

rs.close
Set rs = nothing

'Send email to forum admin
strRecipients = strSender
strFrom = strSender
strFromName = "Automatic Server Email"
strSubject = "Possible Spam Poster"
strMessage = "There is a possible spam poster at " & strForumTitle & vbNewLine & vbNewLine
strMessage = strMessage & "Member " & strSpammerName & ", with MemberID " & MemberID & ", has been trying to send emails to " & strDestName & ", without having enough posts to be allowed to do it." & vbNewLine & vbNewLine
strMessage = strMessage & "Here are the message contents: " & VbNewLine & Request.Form("Msg") & vbNewLine & vbNewLine & vbNewLine & vbNewLine
strMessage = strMessage & "This is a message sent automatically by the Spam Control Mod ;)."

%>
<!--#INCLUDE FILE="inc_mail.asp" -->
<%


end If

End if

rs.Close
end if
'############# End of email spam mod #############

Don't forget that there is another change required for the mod, as per the original post.
I haven't tested this, but it should work.<
kmac
13 November 2007, 09:03


Hi ruirib,

When I try to send the email, I get this error message -
........... Microsoft VBScript runtime error '800a01a8'

Object required: 'rs'

/forum/pop_mail.asp, line 99
........
My new post_mail file is here - http://www.bluemoonfabrications.com/pop_mail2.txt

Thanks, Ken<
kmac
13 November 2007, 09:45


Update - it is sending the spam warning email to the admin, and the content looks good. It's just not returning the "you don't have enough posts" page on the spammer's "send" click<
ruirib
13 November 2007, 10:09


Hmmm... that's why I hate psting stuff without testing.
The new code should be like this:

Code:

'######## Email Spam Mod ############

if Request.QueryString("mode") = "DoIt" then
Err_Msg = ""

strSql = "SELECT M_NAME, M_POSTS FROM " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE M.MEMBER_ID = " & MemberID

set rs = my_Conn.Execute (strSql)

If Not rs.EOF then
intMPosts = rs("M_POSTS")

if intMPosts < 5 then
Err_Msg = "<li>You don't have enough posts to email other members.<br>If you feel that you have received this message in error, please contact the forum administrator.</li>"
strSpammerName = RS("M_NAME")

rs.Close


strSql = "SELECT M.M_NAME FROM " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE M.MEMBER_ID = " & intMemberID

set rs = my_Conn.Execute (strSql)

if rs.bof or rs.eof Then
strDestName = ""
Else
strDestname = rs("M_NAME")
End If

rs.close
Set rs = nothing

'Send email to forum admin
strRecipients = strSender
strFrom = strSender
strFromName = "Automatic Server Email"
strSubject = "Possible Spam Poster"
strMessage = "There is a possible spam poster at " & strForumTitle & vbNewLine & vbNewLine
strMessage = strMessage & "Member " & strSpammerName & ", with MemberID " & MemberID & ", has been trying to send emails to " & strDestName & ", without having enough posts to be allowed to do it." & vbNewLine & vbNewLine
strMessage = strMessage & "Here are the message contents: " & VbNewLine & Request.Form("Msg") & vbNewLine & vbNewLine & vbNewLine & vbNewLine
strMessage = strMessage & "This is a message sent automatically by the Spam Control Mod ;)."

%>
<!--#INCLUDE FILE="inc_mail.asp" -->
<%


end If

Else
rs.Close
Set rs = nothing
End If


end if
'############# End of email spam mod #############
<
kmac
13 November 2007, 10:20


That does it. Thanks for all your help!
Ken<
ruirib
13 November 2007, 10:25


You're welcome.<
Doughnut
13 January 2008, 19:46


Thanks for this...superb mod..!! This'll save so many headaches cool<
ruirib
13 January 2008, 19:51


Glad you like it.<
RhinoOffRoad
14 April 2008, 00:40


ruirib,
thank you very much sir, this mod is exactly what i was looking for. im so tired of these one-hit monkeys joining my board and emailing all my members only to get 100 posts (on the concealedcarryforum.com particularly) on the spam mails the members were getting. thanks again!<
CertGuard
28 April 2008, 22:56


Hey ruirib,

I hope I'm not stepping on any toes here. I received an email from this mod (which is working great BTW)
and decided that the text version of the message did nothing for me, being that I have my forums setup
to send me HTML emails. So, I went through and started formatting the text, then decided to add a few
features to the message.
In this mod variation for HTML emails, I have only modifed the information starting on, or about, line #46
in the pop_mail.asp file.
New features:
  • Offender visible from Subject line
  • Increased legibility of all data
  • Link to offender's profile
  • Link to WHOIS information for offender's IP Address
  • Server Time
  • Offender's RAW Data
  • Link back to this thread so admins like me remember where to find info on itwink
Code:
'######## Email Spam Mod ############

if Request.QueryString("mode") = "DoIt" then
Err_Msg = ""

strSql = "SELECT M_NAME, M_EMAIL, M_POSTS FROM " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE M.MEMBER_ID = " & MemberID

set rs = my_Conn.Execute (strSql)

If Not rs.EOF then
intMPosts = rs("M_POSTS")
intRID = Request.Querystring("id")

strSQL_x = "SELECT M_NAME FROM " & strMemberTablePrefix & "MEMBERS M"
strSql_x = strSql_x & " WHERE M.MEMBER_ID = " & intRID

set rs_x = my_Conn.Execute (strSql_x)

If Not rs_x.EOF then
R_Name = rs_x("M_NAME")
end if
rs_x.close

if intMPosts < 10 then
Err_Msg = "<li>You need more than " & intMPosts & " posts to send emails to other members. If you want to get someone's attention please just post it, we will not neglect you.</li>"
strSpammerName = RS("M_NAME")

'Send email to forum admin
strRecipients = strSender
strFrom = strSender
strFromName = "Automatic Server Email"
strSubject = "Possible Spam Poster [" & strSpammerName & "]"
strMessage = "<font style=""font-family: arial;"">" & vbNewLine & vbNewLine
strMessage = strMessage & "There is a possible spam poster at " & strForumTitle & "<br />" & vbNewLine & vbNewLine
strMessage = strMessage & "Member: <a href=""/forums/pop_profile.asp?mode=display&id=" & MemberID & """><b>" & strSpammerName & "(Member ID " & MemberID & ")</b></a><br />" & vbNewLine
strMessage = strMessage & " # of Posts: <b>" & intMPosts & "</b><br />" & vbNewLine
strMessage = strMessage & "Intended Recipient: <b>" & R_Name & "(Member #" & intRID & ")</b><br />" & vbNewLine
strMessage = strMessage & "Message: <br/><b>" & VbNewLine & replace(Request.Form("Msg"), vbNewLine, "<br />") & "</b><br />" & vbNewLine
strMessage = strMessage & "<hr /><br />" & vbNewLine
strMessage = strMessage & "Remote Address WHOIS: <a href=""http://whois.domaintools.com/" & Request.ServerVariables("remote_addr") & """>" & Request.ServerVariables("remote_addr") & "</a><br />" & vbNewLine
strMessage = strMessage & "Server Time - (1/24): <b>" & Now()-(1/24) & "</b><br/>" & vbNewline
strMessage = strMessage & "RAW DATA: <b>" & Request.ServerVariables("ALL_RAW") & "</b><br />" & vbNewline
strMessage = strMessage & "<hr /><br />" & vbNewLine
strMessage = strMessage & "This is a message sent automatically by the <a href=""http://forum.snitz.com/forum/topic.asp?TOPIC_ID=62640"">Spam Control Mod</a>."
strMessage = strMessage & "</font>"
%>
<!--#INCLUDE FILE="inc_mail.asp" -->
<%


end If

End if

rs.Close
end if
'############# End of email spam mod #############
<
Jaeda
13 October 2008, 20:40


Originally posted by ruirib
Hmmm... that's why I hate psting stuff without testing.
The new code should be like this:

Code:

'######## Email Spam Mod ############

if Request.QueryString("mode") = "DoIt" then
Err_Msg = ""

strSql = "SELECT M_NAME, M_POSTS FROM " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE M.MEMBER_ID = " & MemberID

set rs = my_Conn.Execute (strSql)

If Not rs.EOF then
intMPosts = rs("M_POSTS")

if intMPosts < 5 then
Err_Msg = "<li>You don't have enough posts to email other members.<br>If you feel that you have received this message in error, please contact the forum administrator.</li>"
strSpammerName = RS("M_NAME")

rs.Close


strSql = "SELECT M.M_NAME FROM " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE M.MEMBER_ID = " & intMemberID

set rs = my_Conn.Execute (strSql)

if rs.bof or rs.eof Then
strDestName = ""
Else
strDestname = rs("M_NAME")
End If

rs.close
Set rs = nothing

'Send email to forum admin
strRecipients = strSender
strFrom = strSender
strFromName = "Automatic Server Email"
strSubject = "Possible Spam Poster"
strMessage = "There is a possible spam poster at " & strForumTitle & vbNewLine & vbNewLine
strMessage = strMessage & "Member " & strSpammerName & ", with MemberID " & MemberID & ", has been trying to send emails to " & strDestName & ", without having enough posts to be allowed to do it." & vbNewLine & vbNewLine
strMessage = strMessage & "Here are the message contents: " & VbNewLine & Request.Form("Msg") & vbNewLine & vbNewLine & vbNewLine & vbNewLine
strMessage = strMessage & "This is a message sent automatically by the Spam Control Mod ;)."

%>
<!--#INCLUDE FILE="inc_mail.asp" -->
<%


end If

Else
rs.Close
Set rs = nothing
End If


end if
'############# End of email spam mod #############


okay I've done all of this... and it still lets the spam email go through to the member and it doesn't send a note to the spammer... any advise?<
leatherlips
21 June 2010, 12:52


Excellent MOD! I just had a new member sign up today and start sending spam pm's to several of my members. I added the code for the email and the pm and it works great! Thanks!
ruirib
22 June 2010, 17:55


It's an old one... It is even included in the latest Snitz version wink.
leatherlips
22 June 2010, 21:22


Originally posted by ruirib
It's an old one... It is even included in the latest Snitz version wink.
I have 3.4.05 with many updates so I never installed .07. Nevertheless, this mod is very useful! smile
© 2000-2021 Snitz™ Communications