1

We are implementing a Coupon page on a client's website. Basically just a page that displays the coupon JPG. I have a channel setup with a field to upload an image. The client wants the user to be able to input their email address into a form field and submit in order to get the coupon JPG emailed to them. Any ideas how this can be accomplished? The Coupon JPG will update occasionally. Thanks for any info!

1
  • I know SolSpace Freeform can attach file uploads from a Freeform form file upload field. But there won't be a file upload field, so is there a way to pass the url to the JPG in a hidden field so that it would be attached in the email? – Mike Lohrman Jan 22 '14 at 15:10
2

You cannot attach a file to a notification email unless the file is uploaded along with the form being filled (I recommend submitting this as a Feature Request here: http://support.solspace.com/support/discussions). Usually the best you can do is have a link in your notification email template pointing to your file which users can then download.

With an image file, however, you might have one more option. You will need to enable HTML for your notification email template in Freeform.

Since Freeform 4.x, EE tags can be used in the notification email template body, which means you should be able to retrieve your coupon data from your entry channel. Along with HTML enabled for the entry, you could create an <img> tag in your email body, which should display your coupon to the email recipient.

Here's an example. I'll assume, for demonstration purposes, that your channel is called "coupons" and that your entry_id containing the coupon is "123". The coupon File custom field would be called {cf_coupon_image} in this example. In your email notification template body, you could do this:

{exp:channel:entries channel="coupons" entry_id="123" dynamic="no"}
     <img src="{cf_coupon_image}" />
{/exp:channel:entries}

If HTML is enabled, and your recipient can view HTML emails, the email body should contain an image of your coupon :)

Only catch: the image is still coming from your site. If you change that image in your entry and the filename does not change, this will change the image for the recipient of the email as well.

2
  • It's not 100% want i was hoping, but i think this should appease the client. Thanks for your help! – Mike Lohrman Jan 27 '14 at 14:50
  • Added a small edit about the bottom note: the image would change in the recipient's email if the image in your entry changes and the filename remains the same. Assuming the filename changes and the old image file is still on your server, the recipient of the email should still see the old coupon file. – Solspace Jan 27 '14 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.