Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#41 2018-03-29 10:46:26

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 272
Website

Re: com_connect - form and contact mailer

Hello,
on a website with a contact mail form for customers, they are often entering not the right email address and though the sent mails are coming back. Is there a way to double check <txp:com_connect_email />?

Another point is, that I send these customers every time a copy of their mails. The standard configuration is a little bit confusing for some of them, because nothing is indicating, that this is only the copy for this customer and their “original” mail was delivered. That’s why I changed the Subject for these mails to something like: “Copy: xyz124”.
So one can add a parameter like this: 'copysubject' => 'Copy: ', in com_connect_lAtts(array( and then change the com_connect_deliver to this:


            if ($copysender && $com_connect_from) {
                com_connect_deliver(com_connect_strip($com_connect_from), $copysubject." ".$subject, $msg, $headers, $fields, array('isCopy' => true));
            }

Edited: Textile. — Uli

Last edited by uli (2018-03-29 11:19:39)

Offline

#42 2018-03-29 13:21:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,844
Website

Re: com_connect - form and contact mailer

whocarez wrote #310437:

they are often entering not the right email address… Is there a way to double check <txp:com_connect_email />?

The plugin performs is_valid_email() which checks its format. And if it fails, it checks the domain. So there’s a possibility that the email looks valid (right format) but the domain or TLD is misspelled. A com_connect module (plugin) could do more detailed checks if necessary.

I’m not sure I quite get the ‘copy’ issue. WIll have to read it again later, unless someone else can figure it out.


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

#43 2018-03-29 20:49:18

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,234

Re: com_connect - form and contact mailer

Bloke wrote #310442:

I’m not sure I quite get the ‘copy’ issue. WIll have to read it again later, unless someone else can figure it out.

Looks like it’s not an issue but a tip for us.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#44 2018-03-29 21:01:34

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 272
Website

Re: com_connect - form and contact mailer

I’m sorry, probably I didn’t explain the situation enough.
When “send a copy to sender” is switched on, some of the clients are wondering themselfs, why do I get my own mail? OK, one can explain it in the form and so on, but not everyone understands it or they forget or oversee it, so one solution for me was to rewrite the subject of this copymail. So in this case the client gets his copy and sees already in the subject, that this is only the copy for him. Maybe that would be also useful for others.

Offline

#45 2018-04-05 13:56:10

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,548
Website

Re: com_connect - form and contact mailer

Trying for first time (never a ZCR user either). Bear with me.

Various questions…

1) I’m using this:

<txp:com_connect to="username@domain.tld" subject_form="subject_contact_form">
    <txp:com_connect_text label="Your Name" /><br />
    <txp:com_connect_email /><br />
    <txp:com_connect_select label="Reason for contacting" options=",Thing 1,Thing 2,Thing 3" /><br />
    <txp:com_connect_textarea label="Message" /><br />
    <input class="comSubmit" type="submit" value="Send Email" />
</txp:com_connect>

In source the input and label elements are surrounded with <br> tags. Is that really needed? What about leaving them inline and letting people use display: block; strategically, or whatever? I’ve seen some neat forms before where labels were at left of input fields. The breaks would seem to prevent anyone from doing that who might want to. Not that I do, but I’m just saying.

2) For the life of me I can’t seem to get any style affect on the .comSelect option elements. I’d like those to be larger and more readable than the ancient 11px standard, but damned if anything will take hold.

3) I’m not getting emails on form tests, though it does seem to be functioning otherwise. I’m guessing this is because I’m testing locally and I don’t have any kind of email server setup?

4) If I was on the host’s web server, and I wasn’t seeing the email (yet to be tested), would I/could I eat green eggs… er, use a protonmail address in the SMTP Txp preference? I’m not sure if there’s a particular domain email that has to be there or not.

Offline

#46 2018-04-05 14:12:07

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,976
Website

Re: com_connect - form and contact mailer

Hi Destry,

1) Just leave them out or use break="" to suppress the br.

2) Not all browsers allow styling of dropdown options. There are various more or less convoluted tricks out there to get around it, including restyling the widget as a regular ul-li dropdown. It’s debatable how much it’s worth it, especially on mobile.

3) That’s very likely. If you google you’ll find numerous different ways of catching outgoing email when using MAMP. Usually, I simply try that online, though.

4) Good question. Someone else needs to answer that.


TXP Builders – finely-crafted code, design and txp

Offline

#47 2018-04-05 14:20:16

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,844
Website

Re: com_connect - form and contact mailer

Destry wrote #310660:

the input and label elements are surrounded with <br> tags. Is that really needed?

Not if you don’t want it. Add break="". It defaults to break="br" for legacy reasons (and because that’s what most people use… 80:20 rule).

For the life of me I can’t seem to get any style affect on the .comSelect option elements.

It’s browser specific. Tricky. You can apply it to the entire .comSelect but that also affects the label so you’d need to override that if you can. A general solution is to wrap the options in an <optgroup> but even that seems to have been killed off by some browser (Chrome be damned).

Another solution involves wrapping the entire lot in a label but you’ll need to fudge that by hand and tell com_connect not to use a label on the select (use name="some-label" label="" instead).

I’m not getting emails on form tests, though it does seem to be functioning otherwise. I’m guessing this is because I’m testing locally and I don’t have any kind of email server setup?

Correct. Check your server logs and you’ll probably see it trying to deliver and failing or, more likely, delivering to your root@localhost account.

use a protonmail address in the SMTP Txp preference?

You can set the sender envelope, yes, and com_connect will pick it up and use it. Whether that fixes anything is open to interpretation. Roll on when we can put third party SMTP support in Txp!

EDIT: jakob was faster.

Last edited by Bloke (2018-04-05 14:23:41)


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

#48 2018-04-06 09:36:08

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,976
Website

Re: com_connect - form and contact mailer

Destry wrote #310660:

3) I’m not getting emails on form tests, though it does seem to be functioning otherwise. I’m guessing this is because I’m testing locally and I don’t have any kind of email server setup?

As this is something I’ve often wondered about, I had a quick look if there is an easier way … and there is, at least when you use MAMP or better MAMP Pro on a Mac. I think that’s what you’re using. Here’s a quick how-to if that meets your requirements. It uses Mailhog to allow you to view local outgoing email in a web UI and Homebrew for installing.

Instructions for: MAMP / MAMP Pro on a Mac

1. Open the Terminal on the Mac.

2. If you’ve already used homebrew to install packages via the Terminal, check that it’s up to date with

$ brew update

then proceed directly to the next step (the $ is just the prompt, don’t enter that).

If you don’t have it installed, follow the instructions on the homebrew homepage. It pretty much runs through everything on its own.

If you’re an infrequent Homebrew user (like I am), and you get error messages, you may first need to troubleshoot Homebrew. I hadn’t used it since upgrading to High Sierra and had to reinstall Homebrew first to get it operational.

3. Install Mailhog with:

$ brew install mailhog

4. Set MailHog to start when macOS boots.

$ brew services start mailhog

Now you can access MailHog at its default location: http://127.0.0.1:8025/. You may want to bookmark that in your browser for yourself for future use.

5. In MAMP Pro, switch to ‘Postfix’ in the left-hand menu, and enter:

  • Set domain name of outgoing e-mails to: {yourdomain.tld}
  • Check ‘Use a smart host for routing’
  • Server name: localhost:1025
  • Authentication: none

If you wish, you can set “Include Postfix service in Groupstart” so that it starts along with Apache, PHP and MySQL when you start the MAMP Server.

That’s it!

To test, call up your local test domain and add a new Textpattern user (that sends out an email from Textpattern). Visit the Mailhog window and you should see a new email (sometimes it takes a short while, sometimes it’s practically immediate):

——

If you’re using MAMP (not Pro), you need to manually add details to your php.ini and perhaps also your postfix config as described here and here.


TXP Builders – finely-crafted code, design and txp

Offline

#49 2018-04-06 16:25:21

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,548
Website

Re: com_connect - form and contact mailer

That’s awesome research, Julian! You will make somebody happy, I’m sure. ;) I don’t use MAMP, however. I’ve always preferred the native tools, as much as possible. Sometimes I have to bump up php with Homebrew, so it’s really a game of half/half between Mac native and Homebrew things.

But, I have a different question. I’m using the contact form on a one-page website. I want to be able to use an anchor to link to the form from top of page, externally, or wherever. I’d rather not have to put a div around the form to add the id="" when either the form, fieldset, or legend elements would do just fine. There’s a class="comConnectForm" on the form element, but it needs to be an id for an anchor, doesn’t it? Is there a way with Txp or plugin tag magic?

Maybe Stef will throw one in to make things easier ;)

Offline

#50 2018-04-06 16:35:38

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,548
Website

Re: com_connect - form and contact mailer

jakob wrote #310661:

Just leave them out or use break="" to suppress the br.

I must have missed that in the docs.

Where does it go, exactly? Once in the form tag or individually in each child tag? I’ll probably skip it because it looks okay now, but just curious.

Offline

Board footer

Powered by FluxBB