Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2023-02-27 13:16:55

lindabb
Member
Registered: 2023-02-17
Posts: 132

email templates

Hello,
I don’t know if you guys have email templates plugins or not, I couldn’t find any!
if not, nice to have it,
table with email templates (id, name, and email_body, active) user can pass variables to the body and send email like this

SendEmailbytemplateeme (to, subject, templatename, arrays) ;
arrays can have anything passed to the email body like plugin:

Example:
Dear visitor
Thank you for your comment on [$article_name], posted by [$author] on our website [$Site_URL]
so on ..
Hope you got my point

Thank you

Last edited by lindabb (2023-02-27 13:31:24)

Offline

#2 2023-02-27 13:59:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,437
Website GitHub

Re: email templates

If you’re using com_connect, check out the body_form attribute. That allows you to designate one of your Presentation>Forms as the template. In there you can use the plugin’s tags to iterate over user supplied data, or inject user data into the template wherever you like.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2023-02-27 14:07:57

lindabb
Member
Registered: 2023-02-17
Posts: 132

Re: email templates

Thank you Bloke, this is very good,
I couldn’t find example without form, template as body, do you have an example to pass receptionist email, subject and body to com_connect without form ? I didn’t see this part on the help or I’m not getting it right.

Thank you again

Offline

#4 2023-02-27 14:25:07

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,437
Website GitHub

Re: email templates

lindabb wrote #334808:

I couldn’t find example without form, template as body

If you don’t specify a form, the plugin will use its own internal default form, which is simply a list of all fields the user supplied, e.g.:

name: LindaBB
email: lindabb@example.com
message: Hello,
Please could I have a quote for Widget A?
Thank you.
phone: 0123456789

Assuming you’re using the 4.9.0 version, if you want to customise it then you can designate a form in your tag:

<com::connect to="reception@example.com" body_form="general_enquiry" subject="Contact form enquiry" />

And in your form (of any Type) called general_enquiry:

Enquiry received from
<com::connect_if name="firstname">
    <com::connect_value name="firstname" />
</com::connect_if>
<com::connect_if name="surname">
    <com::connect_value name="surname" />
</com::connect_if>
(<com::connect_value name="email" />).
Message: <com::connect_value name="message" />

Does that help at all?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2023-02-27 20:03:06

lindabb
Member
Registered: 2023-02-17
Posts: 132

Re: email templates

Thank you,
Yes I’m using 4.9.0 , I see someone updated it on github.

Offline

#6 2023-02-27 21:02:04

lindabb
Member
Registered: 2023-02-17
Posts: 132

Re: email templates

I created the form, and called on a page
<com::connect to=“reception@example.com” body_form=“general_enquiry” subject=“Contact form enquiry” />
I assume when I click on section and open the page , this should trigger.

I changed the reception@example.com to my email, I didn’t get any email.
while I can get email from contact form when I fill in as visitor.
any idea ?

Thank you for your help

Offline

#7 2023-02-27 22:37:11

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,437
Website GitHub

Re: email templates

lindabb wrote #334815:

I created the form, and called on a page <com::connect... I assume when I click on section and open the page , this should trigger.

Yes. As long as the code for the plugin is in a Form or Page or is escaped from Textile (if in an article) then it should show up. Once you fill it in, and submit, the email will be sent.

Are you sending via a third party server or using internal mail()? If you want to debug this, a good method is to set your prefs to use SMTP (Advanced mail) and put your site in debugging mode. Then visit the page, fill out the form and submit it.

On the server in your temp directory should be a file called txp_smtp.log and that will contain the entire transcript between your server and the mail server so you can see if it’s being rejected and maybe work out what’s going on from there.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB