Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Include messages in subscription emails
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

CodeWarrior
Starting Member

USA
13 Posts

Posted - 13 October 2003 :  23:23:28  Show Profile  Send CodeWarrior an AOL message  Send CodeWarrior a Yahoo! Message
This may help a few folks around here that seem to have been looking to do the same thing I needed to do with our internal discussion board. The need was to have the text of the new topics, or replies be included in the subscription email. The following code will accomplish this with minimum editing of actual code files and no database modifications. Developed on version 3.3.05, due to limited ASP experience, this may not be the easiest, but at least it's a solution, feel free to offer any constructive critique as you may have.

The one and only file you will need to modify is inc_subscription.asp

Steps to implement:
1) Locate somewhere on or about line #175 the following line: (depending the version, it may not be exactly the same as you see here)
StrSql = "SELECT C.CAT_SUBSCRIPTION, C.CAT_NAME, F.F_SUBJECT, F.F_SUBSCRIPTION " & _
" FROM " & strTablePrefix & "CATEGORY C, " & strTablePrefix & "FORUM F" & _
" WHERE C.CAT_ID = " & CatID & " AND F.FORUM_ID = " & ForumID

2) After the above line (means do not modify or replce the above line) insert the following code:
' Mod to add msg to mailer via email part 1- sb
'-- need some sql to get the msg
replyIDSQL = "SELECT max(Reply_ID) as RepID FROM Forum_Reply WHERE Topic_ID = " & TopicId & " AND Cat_ID = " & CatId & " AND Forum_ID = " & ForumId
Set rsSub = Server.CreateObject("ADODB.Recordset")
rsSub.open replyIDSQL, my_Conn
if rsSub.EOF or rsSub.BOF then
rsSub.close
set rsSub = nothing
exit sub
else
replyID = rsSub("RepID")
end if

if replyID > 0 then
replyMsgSQL = "SELECT R_Message FROM Forum_Reply WHERE Reply_ID = " & rsSub("RepID")
else
replyMsgSQL = "SELECT T_Message FROM Forum_Topics WHERE Topic_ID = " & TopicId
end if

' now get the msg
Set rsSub = Server.CreateObject("ADODB.Recordset")
rsSub.open replyMsgSQL, my_Conn
if rsSub.EOF or rsSub.BOF then
replyMessage = ""
else
if replyID > 0 then
replyMessage = rsSub("R_Message")
else
replyMessage = rsSub("T_Message")
end if
end if

' end mod to add msg to mailer - part 1

3) Locate somewhere on or about line #331 the following line: (depending the version, it may not be exactly the same as you see here)
strMessage = strMessage & "Regarding the subject - " & TopicName & "." & vbNewline & vbNewline

4) After the above line (means do not modify or replce the above line) insert the following code:
' Email posted message modification part 2 - sb
'-- replace the following line
'strMessage = strMessage & "You can view the posting at " & strForumURL & "link.asp?TOPIC_ID=" & TopicId & vbNewline
'with
strMessage = strMessage & "You can view the entire topic at " & strForumURL & "link.asp?TOPIC_ID=" & TopicId & vbNewline

' and add these 2 lines and your good
strMessage = strMessage & vbNewline & "Below is the text of the reply."
strMessage = strMessage & vbNewLine & "************************* M E S S A G E *************************"
strMessage = strMessage & vbNewLine & replyMessage
' end of email reply modification part 2

TccK
Starting Member

5 Posts

Posted - 15 October 2003 :  11:28:51  Show Profile
I would rely like to get the messages in the notification mails.

I haven't tryed the above code, but reading it , I see a (huge) problem: This will give e-mail with plain forum-code.

Anybody an idee (or know a mod) that would make it possible to make the notifications in HTML-format, so it wil send a well formatted notification mail?

This account was hacked into by Image, a very honest guy as you all can see! Stealing people's passwords is his pasttime. Beware of this, before you register at his forums!
Go to Top of Page

gelliott
Junior Member

USA
268 Posts

Posted - 15 October 2003 :  12:36:15  Show Profile
Simply include inc_func_common.asp if it's not already included, and use the formatstr() function to convert the post contents to html.

* The optimist says the cup is half full. The pessimist says it's half empty. But the engineer knows the truth - the cup's design is incorrectly sized.
Go to Top of Page

CodeWarrior
Starting Member

USA
13 Posts

Posted - 15 October 2003 :  13:15:48  Show Profile  Send CodeWarrior an AOL message  Send CodeWarrior a Yahoo! Message
The above code just simply's formats out the text of the notification, hasn't mailed it yet. Try the code
Go to Top of Page

TccK
Starting Member

5 Posts

Posted - 16 October 2003 :  04:40:11  Show Profile
Ok, I tried the code on my version 3.4.03 forum.

I hade some trouble getting it to work, but when I pasted the step 2 code above the lines mentioned in step 1, I got it to work.

As I thought, I started receiving mails in plain forum code.

I used the function suggested by gelliott and started receiving mail with html code (that is plain text mail with readable html).

After editing the cdosys code in inc_mail.asp, I started receiving nice well formatted HTML-mail.

During this process I noticed something what I found weird. That is the mail text and title. In the forum code the way U are subscribed determines the text of the message and title (when it says "new topic" or "new posting"). I changed some stuff there too.
Looking at that code I found it self-evident to put the topic title in the mail title.

This all works fine form me now. If there are people interested in the code, I can place some links to text-files here. I'm not known with all supported mail components to make a mod out of it, but if there is someone who does, make the mod or mail me and we could work together...

This account was hacked into by Image, a very honest guy as you all can see! Stealing people's passwords is his pasttime. Beware of this, before you register at his forums!

Edited by - TccK on 16 October 2003 04:41:47
Go to Top of Page

CodeWarrior
Starting Member

USA
13 Posts

Posted - 16 October 2003 :  05:45:58  Show Profile  Send CodeWarrior an AOL message  Send CodeWarrior a Yahoo! Message
I would be interested in your changes as well, since your changes reflect on a newer Snitz version than what I am currently working on, your changes will most likely save me some time when I upgrade my version soon. Any help or corrections are always appreciated. Thanks TccK
Go to Top of Page

TccK
Starting Member

5 Posts

Posted - 26 October 2003 :  16:29:58  Show Profile
Sry took me so long, I hade some family emergency...

In inc_mail.asp:

Right above:
select case lcase(strMailMode)

Insert:
	strMessage = "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" & vbCrLf _
				& "<html>" & vbCrLf _
				& "<head>" & vbCrLf _
				& " <title>" & strSubject & "</title>" & vbCrLf _
				& " <meta http-equiv=Content-Type content=""text/html; charset=iso-8859-1"">" & vbCrLf _
				& "</head>" & vbCrLf _
				& "<body" & strTmpPageBGImageURL & " bgColor=""" & strPageBGColor & """ text=""" & strDefaultFontColor & """ link=""" & strLinkColor & """ aLink=""" & strActiveLinkColor & """ vLink=""" & strVisitedLinkColor & """>" & vbNewLine _
				& formatstr(strMessage) & vbCrLf _
				& "</body>" & vbCrLf _
				& "</html>" & vbCrLf



In de case, @ 'case "cdosys"', replace:
objNewMail.TextBody = strMessage

With:
objNewMail.HTMLBody = strMessage


Now U have HTML mail from UR forum and can do all CodeWarrior suggested.

Here is my inc_subscription.asp: http://www.obels.nu/images/inc_subscription_asp.txt

This account was hacked into by Image, a very honest guy as you all can see! Stealing people's passwords is his pasttime. Beware of this, before you register at his forums!
Go to Top of Page

gelliott
Junior Member

USA
268 Posts

Posted - 28 October 2003 :  12:46:33  Show Profile
Beware, inc_mail.asp is used many places throughout the forum software. It might be better to make that first change to inc_subscription.asp instead of inc_mail.asp to provide HTML email for that one instance. The second change would not hurt any outgoing message, and should be fine to make in inc_mail.asp.

* The optimist says the cup is half full. The pessimist says it's half empty. But the engineer knows the truth - the cup's design is incorrectly sized.
Go to Top of Page

TccK
Starting Member

5 Posts

Posted - 29 October 2003 :  10:26:43  Show Profile
The first part with:
strMessage = ... formatstr(strMessage) ...

is not without reason!

This garanties that all messages witch wil be send are made pritty!
When U only make the second changes in inc_mail.asp, all other messages will be send as HTML-mail, but with plain-text content.
This will result in mails without any line-feeds etc. By calling formatstr for all mail generated by the forum, these line-feeds are transformed into "<br>".
I tested it and hade best results with the code as described.

This account was hacked into by Image, a very honest guy as you all can see! Stealing people's passwords is his pasttime. Beware of this, before you register at his forums!

Edited by - TccK on 29 October 2003 10:27:22
Go to Top of Page

8minus1
Starting Member

USA
11 Posts

Posted - 30 October 2003 :  12:41:54  Show Profile  Visit 8minus1's Homepage
Part 4 of the directions i changed so that the format looked better and was better to read.

strMessage = strMessage & "You can view the entire topic at " & strForumURL & "link.asp?TOPIC_ID=" & TopicId & vbNewline
strMessage = strMessage & vbNewline & "Below is the text of the reply."
strMessage = strMessage & vbNewLine & "************************* M E S S A G E *************************"
strMessage = strMessage & vbNewline & "Regarding the subject - " & TopicName & "." & vbNewline
strMessage = strMessage & vbNewLine & replyMessage & vbNewline

i added this after line 223 on version 3.4.03 which contains this code:
strMessage = strMessage & MemberName & " has posted to the " & strForumTitle & " board that you requested notification on. "
end if


hope this helps. I did try the inc_mail.asp mod that Tcck suggested and that gave me all html code in plan text.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.21 seconds. Powered By: Snitz Forums 2000 Version 3.4.07