Page 1 of 1

Email users a copy of there picks when entered

Posted: Mon Oct 06, 2014 1:58 pm
by kingmullet
Has anyone ever messed around with this? I am trying to see if there is a way to send users a copy of their picks when they enter them into the pool. There are other sites that do the similar thing and it would be pretty cool if this was possible here.

Re: Email users a copy of there picks when entered

Posted: Tue Dec 01, 2015 11:00 am
by PAUDASH
I just implemented this recently...
Also added the ability to include the IP address of the person making the picks...
Great for audit trails...

I'll do my best to communicate the changes you need to make to weeklyEntry.asp,
Changes in RED, Black text is for reference point of existing code... YMWV

Add Include for Email and encryption at top so we can reuse the email function and access the decryption routine for the email...

<!-- #include file="includes/email.asp" -->
<!-- #include file="includes/encryption.asp" -->


Around line 715

call DbConn.Execute(sql)

'Create array of player picks to eventually email
dim playerpick, playerpicks
playerpick = playerpick &","& pick


next

Then around line 733, again your mileage will vary...

call DbConn.Execute(sql)

'trim the first comma from the list
playerpicks = Right(playerpick,Len(playerpick)-1)


'Email the Picks to the player for their records
if not IsAdmin() then

'Pull the Users email from the Database

dim email, USER_EMAIL
sql = "SELECT * FROM Users WHERE Username = '" & SqlEscape(username) & "'"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
email = GetFieldValue("email", Decrypt(rs.Fields("EmailAddress").Value))
USER_EMAIL = email
EMAIL_SUBJECT = "Your Picks have been made"
end if

call SendMail (USER_EMAIL, EMAIL_SUBJECT, "Your weekly picks for <b>"& USERNAME &"</b> have been recorded on "&Request.ServerVariables ("SERVER_NAME")&"<br/>USERNAME: <b>"& SqlEscape(username) & "</b><br/>WEEK: <b>"& week &"</b><br/>PICKS: <b>"& playerpicks &"</b><br/>TIE BREAKER: <b>"& tb &"</b> <br/>IP ADDRESS: <b>"& Request.ServerVariables ("REMOTE_ADDR")&"</b>")
end if



'Clear any saved weekly results data.
call ClearWeeklyResultsCache(week)

Re: Email users a copy of there picks when entered

Posted: Tue Dec 01, 2015 4:31 pm
by kingmullet
Put this in, but then received the following error when pressing update

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Is this for SQL or the access version?

Re: Email users a copy of there picks when entered

Posted: Tue Dec 01, 2015 4:39 pm
by philwojo
Based on the notes he made it would appear to be for the SQL version, but that is just a guess on my part.

Phil

Re: Email users a copy of there picks when entered

Posted: Tue Dec 01, 2015 6:21 pm
by PAUDASH
I am running access Version....

Maybe have to declare EMAIL_SUBJECT

dim email, USER_EMAIL, EMAIL SUBJECT

I also have call sendmail on one line....
Sorry the forum made two lines...

If you like Ill help troubleshoot...

Can you turn on error reporting and see what the actual error is?

I've uploaded another weeklyEntry.asp...
I just realized my original one had some code in it that also sent a secret email to an audit email...
Helpful if you have someone else managing the day to day and want to know when they make changes for other users...

J

Re: Email users a copy of there picks when entered

Posted: Sat Dec 05, 2015 8:59 am
by kingmullet
Awesome, anyway to incorporate the confidence points selected as well? Everything else works great.

Re: Email users a copy of there picks when entered

Posted: Mon Dec 07, 2015 8:24 pm
by PAUDASH
Perhaps change the code on Line 720 of my modified weeklyentry.asp

playerpick = playerpick &","& pick

to

playerpick = playerpick &","& pick &"-"& conf

Re: Email users a copy of there picks when entered

Posted: Tue Dec 08, 2015 12:04 pm
by kingmullet
Yup that did it! Thanks buddy..

Re: Email users a copy of there picks when entered

Posted: Tue Jan 05, 2016 1:32 pm
by PAUDASH
You're very welcome! Glad I could contribute...

Re: Email users a copy of there picks when entered

Posted: Wed Sep 14, 2016 2:53 am
by nananaja003
Thanks buddy..

golden slot

Re: Email users a copy of there picks when entered

Posted: Thu Sep 05, 2019 2:03 pm
by fbonani
This is my first year working with ASP files and as such have no knowledge of how to "fix" things. The Entry Form that I am using is supposed to send out a copy of the picks to the player (downloaded the edited weeklyEntry.asp file from here) and the following is what the email looks like.

Your weekly picks for <b>Nick K</b> have been recorded on fredspools.somee.com<br/>USERNAME: <b>Nick K</b><br/>WEEK: <b>1</b><br/>PICKS: <b>GB,MIN,BAL,NYJ,KC,LAR,CLE,PHI,SEA,LAC,DET,DAL,TB,NE,NO,DEN</b><br/>TIE BREAKER: <b>41</b> <br/>IP ADDRESS: <b>99.45.56.80</b>

Evidently the <br/> code is not being picked up so the picks are not listed in a column as expected. Does anyone know how to edit the file to make this display in columnar form instead of horizontal as shown? Thanks.

Re: Email users a copy of there picks when entered

Posted: Thu Sep 19, 2019 4:19 pm
by fbonani
This is such a great add on...doesn't anyone know how to change the code to display the picks vertical instead of horizontal?

Re: Email users a copy of there picks when entered

Posted: Thu Sep 19, 2019 4:33 pm
by philwojo
Try changing the code to replace the <br/> with just <br> and see if that works.
I'm no expert that is just a shot in the dark but I don't believe that <br> can ever use the slash.

Phil

Re: Email users a copy of there picks when entered

Posted: Thu Sep 19, 2019 4:50 pm
by fbonani
I never thought about that, but after reading about that tag, it is quite possibly the cause of the problem. I won't know until next week as everyone's picks have been submitted for this week. I will update once I have determined if this is in fact the problem. Thanks for the heads up Phil. BTW, are you the same Philwojo that is on the Turbo Tourney forum?

Re: Email users a copy of there picks when entered

Posted: Thu Sep 19, 2019 5:12 pm
by philwojo
Yes that is me also.

Re: Email users a copy of there picks when entered

Posted: Sat Sep 21, 2019 2:24 pm
by fbonani
philwojo wrote: Thu Sep 19, 2019 4:33 pm Try changing the code to replace the <br/> with just <br> and see if that works.
I'm no expert that is just a shot in the dark but I don't believe that <br> can ever use the slash.

Phil
Changing the code from <br /> to <br> did not change the formatting of the email confirmation. I'm hoping someone can give me a hint as to what I have to do to make the picks display vertically instead of horizontally in the email confirmation.