This topic is locked
[SOLVED]

 Email Attachments

8/26/2014 8:30:41 PM
ASPRunnerPro General questions
D
dem761 author

Can some one explain what "Name" refers to in the sample code below? This code was taken from the ASPRunner Professional 8.1 manual.

I'm trying to use text from a field to create an attachment for an .ics or iCal file.
msg =""

set tmpDict = CreateObject("Scripting.Dictionary")
if values("Field that stores attachments")<>"" then

set fileArray = CreateObject("Scripting.Dictionary")

set fileArray = my_json_decode(values("Field that stores attachments"))

set attachments = CreateObject("Scripting.Dictionary")
for i = 0 to asp_count(fileArray)-1

attachments(i) = getabspath(fileArray(i)("name"))

next

set tmpDict("attachments") = attachments

end if
msg = msg & "Make: " & values("Make") & vbcrlf

msg = msg & "Model: " & values("Model") & vbcrlf
tmpDict("to")="test@gmail.com"

tmpDict("subject")="Sample subject"

tmpDict("body")=msg

set ret=runner_mail(tmpDict)

if not ret("mailed") then

response.write ret("message")

end if

admin 8/27/2014

"name" refers to the part of JSON data structure that stores path and name of uploaded file.
Example - here is the content of File field that contains definition of two uploaded files:

[{"name":"files\/Desert_rmz6pgnm.jpg","usrName":"Desert.jpg","size":845941,"type":"image\/jpeg","searchStr":"Desert.jpg,!Chrysanthemum.jpg,!:sStrEnd"},{"name":"files\/Chrysanthemum_41rdva5e.jpg","usrName":"Chrysanthemum.jpg","size":879394,"type":"image\/jpeg"}]


The value of first "name" field is files/Desert_rmz6pgnm.jpg
I'm not sure though I understand your comment in regards to .ics or .iCal files. Do you upload those files to the database?

D
dem761 author 8/27/2014



"name" refers to the part of JSON data structure that stores path and name of uploaded file.
Example - here is the content of File field that contains definition of two uploaded files:

[{"name":"files\/Desert_rmz6pgnm.jpg","usrName":"Desert.jpg","size":845941,"type":"image\/jpeg","searchStr":"Desert.jpg,!Chrysanthemum.jpg,!:sStrEnd"},{"name":"files\/Chrysanthemum_41rdva5e.jpg","usrName":"Chrysanthemum.jpg","size":879394,"type":"image\/jpeg"}]


The value of first "name" field is files/Desert_rmz6pgnm.jpg
I'm not sure though I understand your comment in regards to .ics or .iCal files. Do you upload those files to the database?


What I'm trying to do is build a file with code written in the After Record Updated event that can be attached to an email. Specifically, I want to create an .ics file based on field values then attach the .ics file to an email.

admin 8/27/2014
  1. You need to add code to AfterAdd/AfterEdit events that creates .ics or .iCal file or files and then save those files to some temporary folder
  2. Send an email attaching those files. The example of sending email with attachment can be found at http://xlinesoft.com/asprunnerpro/docs/runner_mail_function.htm (last example)

D
dem761 author 8/27/2014


  1. You need to add code to AfterAdd/AfterEdit events that creates .ics or .iCal file or files and then save those files to some temporary folder
  2. Send an email attaching those files. The example of sending email with attachment can be found at http://xlinesoft.com/asprunnerpro/docs/runner_mail_function.htm (last example)


Excellent! Thanks for your help. Can you show me an example of how to write to a file in a temp folder on the server? Thanks again.