This topic is locked
[SOLVED]

 Sending Emails at Point of Record Entry

7/9/2009 1:32:53 AM
ASPRunnerPro General questions
A
Aussie Mick author

Hello everyone, one final question...
Below is the standard code for sending an email at point of record entry to include the information of the record being added.
Dim dkeys

message =""
dkeys = dict.keys

For n = 0 To dict.Count-1

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

Next
email="name@domain.com"

subject="Your Subject Here"
sendmail email, subject, message
What I would like to do and I dont know if it is possible is send email to different people based on one particular field in the submission table (called Call Log).
Eg In the call log table if the value for the field called Region is south australia then send an email to x@domain.com but if the region field is Victoria then it goes to y@domain.com and so on... I would need to do this for the following regions
Metro Melbourne

East Victoria

North Victoria

West Victoria

Tasmania

South Australia
Is this possible and if so how would I write the code for this.
Thanks folks for your help.
Speak soon
Mick.

J
Jane 7/9/2009

Mick,
here is a sample:

if values("Region")="South Australia" then

email="x@domain.com"

end if

A
Aussie Mick author 7/9/2009

Thanks Jane, and how would I repeat that for say five regions,
being South Australia, Victoria (all going to differnent people) but i dont know where to put the end if statement etc.
Thanks

Mick,

here is a sample:

A
Aussie Mick author 7/9/2009

Hello Jane
This is the code I am entering.
'** Send email with new data ****

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

' on 'Security->User login settings' dialog
Dim dkeys

message =""
dkeys = dict.keys

For n = 0 To dict.Count-1

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

Next
if values("Region")="South Australia" then email="x@domain.com.au" end if

if values("Region")="Tasmania" then email="y@domain.com.au" end if

subject="New data record"
sendmail email, subject, message
This is then inserting the text in the top of the page rather than emailing it?
Have I done something wrong?
Thanks

J
Jane 7/10/2009

answered in your personal email.