Forums

add image to e-mail template

david.dev 14 Feb, 2010
This is about my attempt to add graphic to e-mail template so that e-mails sent in response to completing the online form would contain an image banner. I tried setting the full path to the image I want included in a response e-mail to user of my form. However, the image never appears
in the response e-mails, which are being sent. The src value below is
always truncated starting with the Joomla path for images. That part
of it is correct but it needs to include the base domain name. See snippet from raw e-mail contents:

<body><p><img src="images/stories/women/Keepers/keepers_web_header.jpg" border="0" alt="Keepers of heart & home" width="600" height="290" />
GreyHead 15 Feb, 2010
Hi david.dev,

There are two ways that I know of round this.

1) The quick fix is to turn off the HTML editor for the email templates. You can do this in the Email Setup Properties box by setting Use Template Editor to 'No'. Apply the Properties box, then Apply the form and the template editor will be a standard textarea where you can enter the full url.

(Note if you turn the HTML Editor back on in the future you may lose the domain again.)

2) This one allows to to continue to use the HTML Editor and is also useful for 'variable images' i.e. different images depending on the form input.

Define the image path as a form input in the OnSubmit Before box.
<?php
$image_url= 'http://www.example.com/images/stories/women/Keepers/keepers_web_header.jpg';
JRequest::setVar('image_url', $image_url);
?>

Now in the Email template click the Image icon and add {image_url} into the link box and Insert.

You will only see {image_url} in the template but when the email is sent ChronoForms will substitute the url value.

Bob
david.dev 17 Feb, 2010
Thank you so much for your help GreyHead. I chose your second option, adding a small PHP snipped using a variable to store the base URL. This works great!
gemlog 11 Mar, 2010
I tried putting similar into "OnSubmit Before Verification:" to work around the same problem with the verification plugin mail, but {image_url} doesn't get replaced. Any other place I should put that?
GreyHead 11 Mar, 2010
Hi gemlog,

I guess that the {input_name} syntax doesn't work there. In which case you need to add the html to build an image link.

Bob
This topic is locked and no more replies can be posted.