Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
I have a set of list view and page view pages, however I want a contact form on the page view page. The contact form is working 100%, error checking, sending, etc, works as expected.

However, I want to be able to find out what page within list view the contact form was sent from.

For example -

I have a set of pages within

Code: Select all
www.website.com/pages/

Like so (Contact form is on these pages in the template) -

Code: Select all
www.website.com/pages/page-1.html
www.website.com/pages/page-2.html
www.website.com/pages/page-3.html

When the user sends an email from the page, I want to be able to find out which page within /pages/ the email was sent from. I thought by using the snippet below it would work, but no avail, it ends up like the screenshot below rather than swapping the CouchCMS code for the actual page name.

Code: Select all
<cms:send_mail from=k_email_from to=k_email_to subject='Contact Form from Pages - <cms:show k_page_title />'>
    The following is an email sent by a visitor to you via the contact form.
    <cms:show k_success />
</cms:send_mail>

Image

Any help would be greatly appreciated.
Hi,

You were on the right track.
The problem in you code is that you've used single quotes instead of double quotes.
Please change your code to this and it should work -
Code: Select all
<cms:send_mail from=k_email_from to=k_email_to subject="Contact Form from Pages - <cms:show k_page_title />">

For a refresher on the significance of the type of quotes used with parameters, please see
http://www.couchcms.com/docs/concepts/s ... eters.html

Hope this helps
Ah that's great KK, that worked, thank you.

While on the subject of emails, when the contact form sends and the email is received, it is incorrectly aligned, do you know why this could be? It looks the same on iPhone Mail, Mac OS X Mail, and Googlemail in multiple web browsers.

Image

Everything else below and including where it says 'phone' is correctly aligned left, whereas the text and 'name' are indented slightly. Nothing major but it would be nice if it could be fixed some way.

I've tried removing the text which says "The following is an email sent by a visitor to you via the contact form." and still get the indentation.

Image

Thanks.
Any content enclosed within the opening and closing tags of cms:send_mail is used *verbatim* as the email's text.
That is to say, if there is a newline after cms:send_mail, the email's content will begin with a newline too. Ditto for leading spaces in sentences.

Looking at the output you posted, it seems your enclosed code contains whitespace (tabs, spaces or newlines) which is showing up in the email.

Please remove all such whitespaces and you'll get a perfectly formatted mail.

Hope this helps.
4 posts Page 1 of 1
cron