This topic is locked

Email with New data added

4/18/2007 10:06:20 AM
ASPRunnerPro General questions
bnphillips author

If I wanted to send an email with new data added for the following fields, MemberID, MemberFirstName, MemberLastName, MemberAddress, MemberCity, MemberState, MemberZipCode, MemberEmail, MemberPhone, MemberType, MemberInterests, UserID, Password --- How would I modify the function BeforeAdd(dict) below.

  1. I would like the email to go to the MemberEmail field. with a BCC for an additional email address (eg. anyname@anywhere.com)
  2. I would like to add some boilerplate text in the message body (eg thank you for your registration etc etc etc.)
  3. I would like to add a subject to the email (eg Your New registration, etc etc etc.)
    Thank you for your time in advance for this help.

    bnp
    Function BeforeAdd(dict)
    ' 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 =""
    keys = dict.keys

    For n = 0 To dict.Count-1

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

    Next
    email="test@test.com"

    subject="New data record"
    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
    End Function

Sergey Kornilov admin 4/19/2007

To add your own message modify the following line:

message ="MemberEmail"
Subject:

subject="New data record"
Email to:

email=dict("MemberEmail ")
To add BCC digg into sendmail function in include/commonfunctions.asp file.
You can modify this function to send CC or BCC or just copy this function code to event and modify it there.
Check the following article to find how use CC and BCC properties:

http://www.paulsadowski.com/WSH/cdo.htm