This topic is locked

Send Email with New Data (only certain fields)

9/5/2007 9:51:08 AM
ASPRunnerPro General questions
bnphillips author

I have a table with the following fields. A,B,C,D,E,F, & G. I have used the send email with new data and that works well. I would like to see some sample code where I can have my email include fields A, B, C, D, E, F. (but not G)
thank you in advance.
-bnp

Sergey Kornilov admin 9/5/2007

Show me the code that you currently use and I'll help you adjust it.

bnphillips author 9/10/2007

Show me the code that you currently use and I'll help you adjust it.


Thank you for your patience.

I am using the before add event for the following table for sending an email with new data.
select [PlayerFeesReceiptsID],

[PlayerRegistrationID],

[FeeCategory],

[FeeAmount],

[PaidCategory],

[EnvelopPostMarkDate],

[PaidAmount],

[PaidCheckNumber],

[DepositNumber],

[PaidStatus],

[BalanceDue],

[Memo],

[Email2]
I would like to include in the email all fields except memo.
-bruce

Sergey Kornilov admin 9/10/2007

Bruce,
this is not an Event code.

bnphillips author 9/18/2007

Bruce,

this is not an Event code.


will try this again.

my code in events section... Before Add..
' Parameters:

' dict - Scripting.Dictionary object.

' Each field on the Add form represented as 'Field name'-'Field value' pair
'** Send email with new data ****

' do not forget to setup email parameters like From, SMTP server etc

' on 'Security->User login settings' dialog
Dim keys
message ="Thank you for submitting your information. Your confirmation status can be found on the Three Rivers Lacrosse web site. Follow the Fall/Winter 2007 links."
message = message & " www.3rl.net"; & vbcrlf & vbcrlf
message = message & "Please note that your confirmed status will appear once payment is received." & vbcrlf & vbcrlf & "Should any of your information be incorrect, please reply to this email with the corrected information."
message = message & " mailto:support@3rl.net" & vbcrlf & vbcrlf
message = message & "There will be a registration night prior to our first games where you can select players to be on the same team. We will try to put 3 or 4 people from the same school on a 3RL Team. Players need to be paid and present by team registration night. If players cannot attend, a responsible adult can be in attendance. We will post this date for both Harmarville and Southpointe upon confirmation with these facilities." & vbcrlf & vbcrlf & "If this email means nothing to you, it is possible that somebody else has accidentally entered your email address. Please advise... and we will remove this entry from our list. " & vbcrlf & vbcrlf & "Thank you." & vbcrlf & vbcrlf & "3RL" & vbcrlf & vbcrlf

message = message & vbcrlf & vbcrlf

message = message & "Your submitted information is as follows. Should there be errors please email us with corrections."

message = message & vbcrlf & vbcrlf

keys = dict.keys

For n = 0 To dict.Count-1

message = message & keys(n) & " : " & dict(keys(n)) & vbcrlf

Next
email=dict("Email")

subject="Three Rivers Lacrosse Registration"
sendmail email, subject, message
BeforeAdd = True
' set BeforeAdd to True if you like to proceed with adding new record

' set it to False in other case
again I would to define only certain fields to be in resultant email
-thanks

-bruce

Sergey Kornilov admin 9/18/2007

Replace the following code snippet:

keys = dict.keys

For n = 0 To dict.Count-1

message = message & keys(n) & " : " & dict(keys(n)) & vbcrlf

Next


with this one:

message = message & "Field1" & " : " & dict("Field1") & vbcrlf

message = message & "Field2" & " : " & dict("Field2") & vbcrlf

message = message & "Field3" & " : " & dict("Field3") & vbcrlf

message = message & "Field4" & " : " & dict("Field4") & vbcrlf