This topic is locked
[SOLVED]

 Sending templated email messages

4/6/2012 2:03:43 PM
ASPRunnerPro General questions
M
McGowan author

I am trying to find a way to create good looking HTML emails to be sent when records are added. For example, when someone signs up to be a new user, I want them to receive a nicely formatted email confirming their registration. I want to be able to provide them other information in the email telling them what to expect next and yadda, yadda, yadda. I even want to include our logo in the email. The Manual tells me how to send emails, even HTML emails, and I have gotten that to work but they don't look nice and formatted the way I would like and I can't get them to be longer than one line or contain images.
I found something in the Tips and Trick section of the PHPRunnerPro forums but I don't know how to make it work for ASPRunner Pro. Does anyone know how to do this in ASPR Pro?
Sending templated email messages
Thanks,
Cody

Sergey Kornilov admin 4/6/2012

This code should be pretty trivial to convert to ASP. Instead of str_replace() function use Replace function in ASP.
More info on Replace() function:

http://www.w3schools.com/vbscript/func_replace.asp

M
McGowan author 4/9/2012

Sergey,
I appreciate the reference to the Replace() function and www.w3schools.com but I need a little more information.
Let's say I've created a text file containing the HTML email message I want to send and I've named that file "message.txt". Now I have two specific questions.

  1. Where do I place the file (root folder, templates, include, etc)?
  2. What would that Event look like?
    I've tried and failed using the text below:
    '** Send HTML email ****

    email_message = file_get_contents("message.txt")
    set params = CreateObject("Scripting.Dictionary")
    params("to")= values("Email")
    params("subject")="Thank you for your order"

    params("htmlbody")= email_message
    params("charset")="UTF-8"
    runner_mail(params)
    Thank you.

jtksmith 4/10/2012

I too have been unsuccessfully trying to make this work.
I have found no explanation of the "file_get_contents" function in the ASPRunner manual nor have my searches of the forum produced useful information. Furthermore, my searches of the Internet lead me to believe the "file_get_contents" is not compatible with ASP but is only for use with PHP.
w3schools.com has instruction for using something like > <!--#include file="file.inc"-->

but I'm not sure how to apply that in an event.
If someone could provide a simple example of how to write an event in ASPRunner Pro 7 that would use a file to send a formatted email with the ability to use "Replace" function and include instructions as to where to put that file on the server so that the event can use it, it would be very helpful.
Thank you in advance.

Sergey Kornilov admin 4/11/2012

file_get_contents is a built-in PHP function. In ASP you need to use any other function that can read the contents of the file into a variable. You can find examples of doing this at http://www.asptutorial.info/learn/OpenReadCreate-files.html (first example).

jtksmith 4/12/2012

Sergey,
Thank you very much. I was able to use the information from the above posts and referenced sources to figure out how to make this work.