This topic is locked

Sending Email on Table Entry

3/15/2006 8:28:44 PM
ASPRunnerPro General questions
L
larryreed author

Been eval'ing ASPRunner for a couple of weeks and I see many uses I will be able to use it for once I purchase it. One important thing I have not been able to figure out is this......
When a user fills out a form and the data is submitted, I would like to have an email be sent back to the user. I want it sent to whatever email that is filled out in the form. The email could be different each time so I can not do the "simple email on page add" which is a hard coded email.
My application will be a website where team will register for different events, and I want them to get a copy of their entry sent back to them, I want a copy sent to my email address, and I want anyone else that visits the website to be able to do a list to see who has already registered.
Some advise would be appreciated.
Larry

Sergey Kornilov admin 3/16/2006

Larry,
you can do it using Send email with new data event.

Function BeforeAdd(dict)

message =""

keys = dict.keys

For n = 0 To dict.Count-1

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

Next

email=dict("entered_mail")

email1="admin@test.com"

subject="New data record"

sendmail email, subject, message

sendmail email1, subject, message

End Function



where entered_mail is field name, which user type his own email in.

So you can make list with registered team using Search or Advanced Search.

A
ashumak 3/30/2006

Works so far although I hear some do not go through for some reason.
What I was wondering is there any way to send the email with formated text? Either html or spaced so it would be easier to read?
Alan

Sergey Kornilov admin 3/31/2006

Hi,
to add html to your email:

  1. add html tags to email text
  2. build your project
  3. open include/commonfunctions.asp file, find Sendmail function and replace

myMail.TextBody= message



with

myMail.HtmlBody= message
A
ashumak 3/31/2006

O.k. Too fast for me. The email being sent is the new data added to the table. All I really want is the same html style as the view the see. Where do I find the email test to add html tags to?
Alan

Sergey Kornilov admin 3/31/2006

Alan,
the message text is in message variable in the code I provided before for BeforeAdd event.

I.e. to add
tags modify the code like this:

For n = 0 To dict.Count-1

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


Next