Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Emailer

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Dave Goldman Posted - 31 October 2009 : 16:12:26
Hey guys, I have a fast question. I wrote some code so I can send an email to the user if it is their birthday. I am piggybacking off of another function from a mod and I would like to know the best way to retrieve the users name and email address.

function EmailUserBirthdayNotice

Dim userName, userEmail
' Need to retrieve the data

'## E-mails Message to the Author of this Reply.
strRecipientsName = userName
strRecipients = userEmail
strFrom = "My Forum"
strFromName = strForumTitle
strsubject = "Happy Birthday " & userName & " !"
strMessage = "Hello " & PWMember_Name & vbNewline & vbNewline
strMessage = strMessage & "You received this message from My Forum because today is your birthday. We wanted to wish you a Happy Birthday!" & vbNewline & vbNewline
strMessage = strMessage & vbNewLine & "Have a great birthday!." & vbNewLine & vbNewLine
strMessage = strMessage & vbNewLine & "My Forum" & vbNewLine & vbNewLine
%>
<!--#INCLUDE FILE="inc_mail.asp" -->
<%

end function

Thanks
Dave
7   L A T E S T    R E P L I E S    (Newest First)
Carefree Posted - 02 November 2009 : 08:35:42
quote:
...it needs the event mod and the birthday mod, adding a new field M_SENTMAIL to MEMBERS_BDATES table


Not really. All you'd have to do is add a variable to "config.asp", store the date in it when it starts to send EMails. Then when the function is called, check the value of the variable. If it matches the current date, don't send. Done.

I made the appropriate change in above post.
Dave Goldman Posted - 01 November 2009 : 09:14:20
I do have both mods installed. Do you want me to test it? Do you have the link to the exact event mod just so I can make sure I have the same one as you?
modifichicci Posted - 01 November 2009 : 08:22:46
quote:
Not if he's going to manually run the program from an admin console page


not very comfortable...
I have implemented the function, but it needs the event mod and the birthday mod, adding a new field M_SENTMAIL to MEMBERS_BDATES table
That is possible as the mod store the dob in that table and delete them after sometimes, so the field is set to 0 again next time..
Dave Goldman Posted - 01 November 2009 : 07:57:55
Is there an easy way to check for that? Possibly adding a new field to the database? I think this would be a cool add in. What I did was took an old post that basically checked the birthday by calling two functions isbday and getGreeting. Basically I just wanted to send the email one time if it was the birthday as these two functions just say happy birthday in the header.
Carefree Posted - 01 November 2009 : 05:37:29
Not if he's going to manually run the program from an admin console page - it'll only send one per person with a birthday on that date. If he embeds it in a commonly accessed page, then you're correct, it would send the emails every time that function was called.
modifichicci Posted - 01 November 2009 : 05:20:18
you need to add a check to see if the mail has been sent to avoid a lot of mail to be sent
Carefree Posted - 01 November 2009 : 03:59:45

<%
Function EmailUserBirthdayNotice
	strDOB=mid(strtodate(strForumTimeAdjust),4,4)
	strSql="SELECT C_VARIABLE, C_VALUE FROM "& strTablePrefix & "CONFIG_NEW WHERE C_VARIABLE='STRBIRTHMAIL'"
	set rsBDay=my_Conn.Execute(strSql)
	if not rsBDay.EOF then
		strCDOB=rsBDay("C_VALUE")
		rsBDay.Close
	end if
	set rsBDay=Nothing
	if strCDOB<>strDOB then
		strSql="UPDATE "& strTablePrefix & "CONFIG_NEW SET C_VALUE='" & STRDOB & "' WHERE C_VARIABLE='STRBIRTHMAIL'"
		my_Conn.Execute(strSql)
		strSql="SELECT M_FIRSTNAME, M_EMAIL, M_DOB FROM " & strMemberTablePrefix & "MEMBERS WHERE MID(M_DOB,4)="&strDOB
		set rsDOB=my_Conn.Execute(strSql)
		if not rsDOB.EOF then
			do until rsDOB.EOF
				strRecipientsName = rsDOB("M_FIRSTNAME")
				strRecipients = rsDOB("M_EMAIL")
				Call SMail
			loop
			rsDOB.Close
		end if
		set rsDOB=Nothing

		Sub SMail		
			strFrom = "My Forum"
			strFromName = strForumTitle
			strsubject = "Happy Birthday " & userName & " !"
			strMessage = "Hello " & PWMember_Name & vbNewline & vbNewline
			strMessage = strMessage & "You received this message from My Forum because today is your birthday. We wanted to wish you a Happy Birthday!" & vbNewline & vbNewline
			strMessage = strMessage & vbNewLine & "Have a great birthday!." & vbNewLine & vbNewLine
			strMessage = strMessage & vbNewLine & "My Forum" & vbNewLine & vbNewLine
			%>
			<!--#INCLUDE FILE="inc_mail.asp" -->
			<%
		End Sub
	end if
End Function
%>

To add the variable to the config_new table, save the following as dbs.BMail and execute from admin control panel.
Birthday Mail Mod v1.0
[INSERT]
CONFIG_NEW
(C_VARIABLE,C_VALUE)#('strBirthMail',0)
[END]


Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07