Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#217 2017-06-26 13:21:49

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,908
Website GitHub Twitter

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

What I did is that I created a form called zcr_spam_patterns and just added one line containing *?@businessloansfunded.com/

I have sent my self an email using their credentials. I am yet to receive it. No errors were shown after clicking on the send button.

> Edit. I did receive it. It took about one hour but it did arrive! I’ll now try the full address in the form

Last edited by colak (2017-06-26 13:24:32)


Yiannis
——————————
neme.org | hblack.net | EMAP | A Sea change | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#218 2017-06-26 13:47:59

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,908
Website GitHub Twitter

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

The second email arrived too…. It does not seem to work ?


Yiannis
——————————
neme.org | hblack.net | EMAP | A Sea change | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#219 2017-06-26 14:09:58

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,795
Website GitHub

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

colak wrote #306088:

*?@businessloansfunded.com/

You need the leading forward slash and a dot-star for “any character”. The question mark means “not greedy”:

/.*@businessloansfunded.com/

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

#220 2017-06-26 14:29:51

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,908
Website GitHub Twitter

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

Hi Stef,

Thanks so much for your attention. I tried both

/*?@businessloansfunded.com/ 

and

/fundingteam+mydomain.tld.*?@businessloansfunded.com/

but the emails are still arriving!


Yiannis
——————————
neme.org | hblack.net | EMAP | A Sea change | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#221 2017-06-26 14:56:40

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,795
Website GitHub

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

colak wrote #306091:

/*?businessloansfunded.com/…@ and /fundingteam+mydomain.tld.*?businessloansfunded.com/…@

Neither of those will match, so the emails will arrive. For the first one:

  • *? is not a valid regex character sequence.
  • .* is.

For the second:

Unless your emails are from the exact email address ‘/fundingteam+mydomain.tld@businessloansfunded.com’ they will not match. I assumed that ‘mydomain.tld’ was a variable each time, hence I replaced it in my example with .* (any character). So:

/fundingteam.*?@businessloansfunded.com/
should match any of these:
  • fundingteam+example.org@businessloansfunded.com
  • fundingteam+neme.com@businessloansfunded.com
  • fundingteamneme.org@businessloansfunded.com
  • blobbyfundingteamwhatever.com@businessloansfunded.combobulated

EDIT: the last one will match because we’re not anchoring the search pattern to the “start” and “end” of the string. If you wanted to do that, you would use the ^ (start) and $ (end) like this:

/^fundingteam.*?@businessloansfunded.com$/

Last edited by Bloke (2017-06-26 14:59:55)


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

#222 2017-06-26 15:03:00

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 1,959
Website Mastodon

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

? per your reasons: *? is not a valid regex character sequence.

/fundingteam.*?@businessloansfunded.com/

should it be

/fundingteam.*@businessloansfunded.com/

i.e. sans “?”


…. texted postive

Offline

#223 2017-06-26 15:10:04

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,795
Website GitHub

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

bici wrote #306093:

‘*?’ is not a valid regex character sequence, should it be /fundingteam.*businessloansfunded.com/…@

Well, it could. But the question mark is a modifier for the previous “thing” (in this case the .* – any number of characters) that stops it being greedy and consuming more letters than necessary. Normally, regex patterns are greedy. While in this case — with so much extra text around it, the greediness is probably not an issue, it was just me being cautious in case the input string was mangled in some other way. You can probably omit the question mark. But the .* is important:

  • The dot means “any single character”
  • The star means “zero or more of the preceding character”

So, .* means, technically, “zero or more characters, any characters, doesn’t matter, as many as you can find until you hit the next part of the expression that matches”.


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

#224 2017-07-04 09:53:38

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,908
Website GitHub Twitter

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

I am trying to create a custom subject line for the emails received from the form

What I currently have is:

txp 
<txp:zem_contact to_form="my_zem_contact_to_form" 
subject_form="State_Machines_Inquiry"  thanks="Thank you, your message has been sent.">
...

I created the subject_form and in it, I have:

<txp:php>
global $zem_contact_form;
echo $zem_contact_form['State Machines Inquiry'];
</txp:php>

but the emails are arriving with a (no subject) title. Can anyone point me to what I might be doing wrong?


Yiannis
——————————
neme.org | hblack.net | EMAP | A Sea change | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#225 2017-07-04 10:32:09

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,795
Website GitHub

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

So your <txp:zem_contact> container has something like this in it?

<txp:zem_contact to_form="my_zem_contact_to_form" 
subject_form="my_zcr_subject" thanks="Thank you, your message has been sent.">
<txp:zem_contact_email />
...
<txp:zem_contact_select label="State Machines Inquiry" options="General inquiry, Specific inquiry, Just for fun" />
...
</txp:zem_contact>

As long as your Form is called my_zcr_subject and has the code you specified above, it’ll pick it up and use it by matching the label you used inyour select dropdown to the $zem_contact_form key. Your subject_form name needs to match exactly, including upper-and lower-case. It works in my tests here.


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

#226 2017-07-04 11:10:46

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,908
Website GitHub Twitter

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

I see what you mean and that might be a usability issue.

In the select field I have

<txp:zem_contact_select name="Organisations" label="Select organisation you wish to contact" options="General inquiry, Specific inquiry, Just for fun" />

By changing the label, it will make it harder for the people to understand what that pull down does.

I’ll have to rethink what will be good for us, and for the visitors.


Yiannis
——————————
neme.org | hblack.net | EMAP | A Sea change | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#227 2017-07-04 11:16:24

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,795
Website GitHub

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

What’s the advantage to your receipients to have a user-selected subject line? Your ‘Organisation’ field already determines who receives the email. You can either hard-code the subject line in the form itself, or use another select with a list of subjects in it that users can choose.

If it’s important to your visitors (and recipients) to be able to pick what an email is about from a pre-defined list in the ZCR form, then add a second select to the form. It adds to the burden for the users though (one more form field) so consider any perceived benefits wisely!


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

#228 2017-07-04 11:23:15

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,908
Website GitHub Twitter

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

Bloke wrote #306189:

What’s the advantage to your receipients to have a user-selected subject line? Your ‘Organisation’ field already determines who receives the email. You can either hard-code the subject line in the form itself, or use another select with a list of subjects in it that users can choose.

If it’s important to your visitors (and recipients) to be able to pick what an email is about from a pre-defined list in the ZCR form, then add a second select to the form. It adds to the burden for the users though (one more form field) so consider any perceived benefits wisely!

Hi Stef, thanks yet again!!!

The advantage will be that of properly searching for the emails in gmail. How can I hard-code the subject? In fact I was looking for that. Would it be:

<txp:zem_contact_select subject="State Machines inquiry" name="Organisations" label="Select organisation you wish to contact" options="General inquiry, Specific inquiry, Just for fun" />

> Edit: Yes it is!! wonderful…. Done!

Last edited by colak (2017-07-04 11:26:33)


Yiannis
——————————
neme.org | hblack.net | EMAP | A Sea change | NeMe @ github
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB