Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: SMTP mail arrives in Textpattern (finally!)
Okay. I mentioned that to them. And they came up with a solution that requires any users I create a login for, would need access to my cpanel email. Not going to happen.
So I thanked them for trying. I’ll just go to my cpanel email and copy the link. Email to the user so they can set their password.
Offline
Re: SMTP mail arrives in Textpattern (finally!)
As of this commit I’ve added native support to our new SMTP Mail transport layer for file attachments. I also extended the support to the old mail()
route as well, for completeness. Since we’re adding SMTP support anyway, and PHPMailer supports attachments, it seemed remiss to leave them out.
That means you can now add attachments via file uploads in com_connect which further expands its capabilities. It’s only for the 4.9.0 branch of the code, which will be released to coincide with Txp 4.9.0’s release.
Anyone using ext_file_attach for this functionality, which was deeply flawed, please retire it from your installations. It is considered a dead project from this moment forward.
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
Online
Re: SMTP mail arrives in Textpattern (finally!)
Bloke wrote #336955:
That means you can now add attachments via file uploads in com_connect which further expands its capabilities. It’s only for the 4.9.0 branch of the code, which will be released to coincide with Txp 4.9.0’s release.
Excellent, yet another string to the bow of com_connect, and again more consolidation into core (and associated) tags. I’m sure this will come in handy. And another big thanks!
BTW: the com_connect_file
needs adding to the readme table of contents (but that may no longer be relevant anyway given that the plugin makes it’s own sidebar in-page nav).
TXP Builders – finely-crafted code, design and txp
Offline
Re: SMTP mail arrives in Textpattern (finally!)
jakob wrote #336956:
Excellent, yet another string to the bow of com_connect
Yeah, I’m pleased with the implementation on the whole. It could do with some more thorough testing. I’ve only tried it with one file uploader in a form, with and without multiple
. It should allow multiple file upload widgets of differing types and accept
lists.
There’s a tonne of validation goes on server side, but I’ve not vigorously tested what happened if you exceed file size maximums and so forth. At the moment I think it will not send the entire message if one of the files goes over size. And, annoyingly, if you then repick the files and try to resubmit the form, it will tell you the form has already been used and the page needs refreshing. That’s irritating and I’d love to find a way round it. Creative solutions welcome.
the
com_connect_file
needs adding to the readme table of contents
Oops. Probably missed one. I’ll fix that for completeness, thank you.
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
Online
Re: SMTP mail arrives in Textpattern (finally!)
Some attempt at testing:
localhost, Apache + PHP 8.3, com_connect updated.
debug mode: ON.
Code used:
<txp:com_connect_file label="Attach PDF file" accept="application/pdf" max="1000000" multiple="0" />
Pressing submit, com_connect error message, attaching 1 small PDF file (~ 11kb ):
Attach PDF file must not exceed 1000000.
Wut ? 11kb is more than the specified max-limit ? (in bytes, according to the docs)
Oh, the message might be more kind when saying “not exceed 1000000 bytes” (although little old me thinks kb
would me much more clear for the average user ).
OK, trying without specifying a max
value, now the error says not exceed 8388608
(which is the value set in php.ini
, I think (upload_max_filesize = 8M
))
sigh/ can‘t seem to get further there…
–^–
Docs:
- Perhaps you may clarify what the values for multiple
are (e.g. multiple="1"
-> multiple files, multiple="0"
-> 1 file only)
- the last sentence in the “required” entry does not belong there:
required=“boolean”
Whether this file must be supplied. Available values: 1 (yes) or 0 (no). Default is whatever is set in the <txp:com_connect> tag’s required attribute – if neither attribute is set then default is 1. You should set the required attribute on only the first radio button of the group, or set the same identical attribute value on all radio buttons in the group.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: SMTP mail arrives in Textpattern (finally!)
Sorry about the hassle. For some irritating reason, I had a real job trying to get the uploads file size limited. Some browsers were fine with the hidden max_file_size attribute and the server side testing per file, some treated it as an overall size for all uploads, and some ignored it or always told me that no matter what I uploaded was too big.
Thought I’d ironed it out, but it looks like I need to do more rigorous cross browser testing. Thanks for giving it a go. I’ll fix the copy n paste docs error too, thank you.
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
Online
Re: SMTP mail arrives in Textpattern (finally!)
I see I forgot to mention it, my testing was done with Safari TP, Brave and Firefox.
I hope you manage to iron it out as this could make com_connect
really powerful.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: SMTP mail arrives in Textpattern (finally!)
Just tested with a 10.1MB file.
Code used.
<txp:com_connect_file label="Send file" max="8000000" accept=".pdf,.docx,.doc,.txt,.rtf,.pages" required="1" />
All worked like a dream on PHP v8.0.30 and latest txp 4.9.0-dev (82e9fc43f1cb2612ff6a22219a774a07)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: SMTP mail arrives in Textpattern (finally!)
With the latest update to com_connect – I get the same result as before both locally and a remote server (running PHP 8.2) (Attach pdf file must not exceed 1000000.
)
Observation: marking the txp:com_connect_file
as not required (required="0"
) makes the file upload work – the form is submitted without problem (localhost is not configured to actually send email).
From the live server, I receive the email. But no file is attached.
If I do not specify a template for the email body, then the email has this in the body field:
Email: xxx@yyy.tld
Name: tester2
Subject: Site issue
MAX_FILE_SIZE: 1000000
Message: testing the attachment of files(2)
I accept the above information will be used to contact me.: Yes
if I do specify a template for the email body (<txp:com_connect […] body_form="pw_contact_message_body">
), then I recieve the same email, without the MAX_FILE_SIZE
line (an no attached file).
The body_form
contains this line (the name="attached_pdf"
is the name of the file upload field):
<txp:com_connect_if name="attached_pdf"><txp:com_connect_value name="attached_pdf" /></txp:com_connect_if>
Dunno, maybe I am doing something totally wrong, I have no idea what it might be.
Full form template:
<h1><txp:section title='1' /> – Empty Spaces</h1>
<txp:com_connect class="contact-form-form" classes="element:warn-field, required:required-field, wrapper:error-message" label="" to="xxx@l-c-n.com" from="xxx@l-c-n.com" subject="[emps] test form" thanks="First part of testing has been successful" body_form="pw_contact_message_body">
<section class="contact-form-container" aria-label="contact form">
<div class="input-field"><txp:com_connect_email break="" class="" label="Email" name="email" placeholder="Your email address" /></div>
<div class="input-field"><txp:com_connect_text break="" class="" label="Name" name="name" placeholder="Your Name" /></div>
<div class="input-field contact-subject">
<txp:com_connect_select break="" class="" label="Subject" name="subject" options="{Select one},General enquiry,Site issue,Other…" />
</div>
<div class="input-field"><txp:com_connect_file break="" class="" label="Attach pdf file" name="attached_pdf" accept="application/pdf" max="1000000" required="0" /></div>
<div class="contact-message"><txp:com_connect_textarea class="" name="message" break="" label="Message" max="256" /></div>
<div class="input-radio-field"><txp:com_connect_checkbox class="" label="I accept the above information will be used to contact me." name="accept" /></div>
<div><txp:com_connect_text hidden label="" name="office_phone" required="0" />
<txp:com_connect_expect name="office_phone" /></div>
<p><small>Please note that fields marked with <span class="required">*</span> are required</small></p>
<txp:com_connect_serverinfo name="REMOTE_ADDR" label="IP number" />
<div class="submitfield"><input type="submit" value="Submit"></div>
</section>
</txp:com_connect>
nothing crazy or unexpected I think.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: SMTP mail arrives in Textpattern (finally!)
BTW, a small issue: classes specified on the <txp:com_connect
container are not propagated to the txp:com_connect_file
tag.
<txp:com_connect class="contact-form-form" classes="element:warn-field, required:required-field wrapper:error-message">
<div class="input-field">
<txp:com_connect_file break="" class="" label="Attach pdf file" name="attached_pdf" accept="application/pdf" max="1000000" multiple="0" />
</div>
output
<div class="input-field">
<label for="attached_pdf" class="comRequired">Attach pdf file</label>
<input class="comRequired" accept="application/pdf" id="attached_pdf" name="attached_pdf" multiple="" type="file" form="com394332ecc17c4f8b8b23ab47738aec4b" required="">
</div>
Expected: the class="comRequired"
is replaced by class="required-field"
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: SMTP mail arrives in Textpattern (finally!)
Pants. Forgot to hook the tag into those. Great spot, thank you.
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
Online
Re: SMTP mail arrives in Textpattern (finally!)
Hi
Nice evolution for the plugin!
I admit that i am wondering if it s too complicated to create a plugin that instead of sending the files on Email to store them on the server ?
Cheers.
Offline