In reference to the following quote/post (version 1.1.3)
..apparently persists in the ElkArte version currently running as I post this. JPalmer reports
HERE (https://www.elkarte.net/community/index.php?topic=5886.msg41589#msg41589).
@Spuds - did you find that as a bug (https://www.elkarte.net/community/index.php?topic=5196.msg36965#msg36965) back then, as you were going to investigate?
(I can't see emailed attachments posted anywhere in the thread here, or in my own forum, but that's a different problem..).
Update: once radu81 "approved" the attachment, I could see it in that thread, but in the post I replied to, not in the reply post the attachment was the payload of, which becomes, now, three issues:
1 - Like the email attachments appearing in edweis's forum v. 1.1.3 (in the wrong post), the problem of emailed attachments also appearing in the wrong post persists in this forum v. ? (once moderator approved).
2 - Emailed attachments do not show up in my forum v.1.1.6, at all, in spite of email attachments configured - Allow email file attachments to be posted is checked.
(I am using the cron job method, not the IMAP method - could that be the difference? I'm also using PHP 7.2. which I mention only because some behavior anomalies are now being observed and reported between 7.2 and 7.3 and 7.4)
3 - Last - (more a curiosity) why could JPalmer see the attachment in his post that I replied to, but not me, BEFORE it was approved by the moderator? (And then once moderator approved, I could see it...in the wrong post..)
I "really" need to get emailed attachments working, and working correctly, in my forum. Thoughts?
-Steeley
Update: It turns out that attachments WILL go through in my forum (1.1.6) just like they do in 1.1.3 and ElkArtes 1.1.5, ..BUT... the emailed attachment has to be in a reply to a reply.. Then the attachment posts in the message being replied to, not in the reply it was attached to.
If the emailed attachment email is starting a new topic, the attachment disappears completely (since there's no previous message to attach it to).
Another issue popped up during testing.. I'll post another bug report regarding starting a new topic via email by changing the subject.
Could you please reply to this topic? I want to try posting an attachment by email.
Here's an email reply, with an attachment payload, emanuele.
(It will probably end up in your post, not mine..)
-Steeley
Did you exchange, a walk-on part in the war for a lead role in a cage? [~ Pink Floyd: "Wish You Were Here"]
On 6 Dec 2020 at 19:15, emanuele via ElkArte Community wrote:
Bugs creator.
Features destroyer.
Template killer.
I'd need another, I forgot I turned notifications off. xD
OK, here's another...
And the attachments need to be moderator approved apparently (at least for me to see it)
-Steeley
Did you exchange, a walk-on part in the war for a lead role in a cage? [~ Pink Floyd: "Wish You Were Here"]
On 6 Dec 2020 at 19:35, emanuele via ElkArte Community wrote:
I'd need another, I forgot I turned notifications off. xD >
Bugs creator.
Features destroyer.
Template killer.
BTW, I don't believe attachments posted in the forum will be included in email notifications sent out by Elk..
(And that's not a complaint. In my opinion, it's preferable - if they want to see it, click the link in the email and log in...)
Testing out reply with attachments Steeley via ElkArte Community wrote on 12/6/20 9:23 PM:
Tracked:
https://github.com/elkarte/Elkarte/issues/3415
OK, I've created a github account. Should I participate further there or standby here?
I'm considering trying your suggested fix and see what happens..
I'm just not sure at what point the message with attachment is assigned a message ID (if message ID for the attachment is set to "0") and whether a subsequent message ID assignment will "lose" the attachment.
I think that's what happens if the email is a NEW topic.. (no message ID), and thusly it appears the attachment is "lost"
(It doesn't end up in the attachments folder, at all) I misspoke, the attachment ends up in the attachments folder (If I'm going to test the function, I should enable it first as emanuele said). The attachment and its thumbnail are registered in the db (table: eln0_attachments) and linked to message ID "0".
As there is no message id 0 "it just sits there".. .
It appears that new topic email posts with attachments mimic the proposed fix (setting message id to "0"). and when the message posts with it's new message ID, the attachment (or the database) isn't updated with the new message id, and gets orphaned.
I'm slowly getting around to looking at this some more ... well at all. I do feel what you found is correct, the attachment is getting its id from the reply and adding it there instead of the "new"post. which should be 0 nods
I've been in the middle of changing from my vagrant environment to a docker one and am still working things out. At least I now have php7.4 and Elk 1.1.7 set up so can begin to fix some of those annoyances. Setting up various php/db/elk stacks is very easy as well.
Trying out a mailhog container to help debug the PBE issues but still have work to do to make it useful, if it can even do what I want!
I'm retired, my dockers are in a bottom drawer somewhere and I've transitioned back to full vagrant caparison. People even hand me spare change.. Life is grand..
Who can ever forget the era of fat arsed docker jeans :D
Speaking of which.. would someone please tell me what the "PBE" acronym stands for? I'm old-skewelled.. it's not in my leather-bound C/pm user manuals anywhere (although I did discover the C/pm command "ERA" worked in DOS too - Gates, you sneaky bas..rd.)
Post By Email
Ah.. my guess was "public beta environment " in ref to v 1.1.7... Thanks! :P
Back to the issue of this topic ...
There are two things here ... One is what was identified, that the post id should be set to zero such that they are processed but not yet owned by an existing message.
Then on successful new message/reply creation, we need to also ``bindMessageAttachments`` to have the new message own the new attachments. I have it fixed on my local.
Yessir - didn't uncover the second until I looked at the code and database after the first was pinpointed by emanuale.
That is indeed outstanding news Spuds. Email without an attachment is like Ray Charles at the Musée du Louvre. ::)
If you can post the patch, or email it to me, I'll happily "beta test" it on my site..
Will do ... I'm actually making several changes as I saw some other opportunity --- or I'm off in the weeds :P
Either way I'll post the files to try when available, just save/rename your existing files in case you need to back out of the test!
Roger that... just comment your changes so I know which ones to back out :D without dif'ing the files and guessing what is for what. .
., (and if you find my turtle let me know..)
Here are the changes .... for the attachment problem you need to save and replace (2) files
first in /sources/subs Emailpost.subs.php and then in /sources/controllers Emailpost.controller.php Just to note this will not inline any attachments no matter how the email arrives, all attachments are done as below the post style.
I also made some changes to the email parser that separate to the attachment issue. This version should be a little lighter on the memory in some cases, it also does a better job at selecting the best representation of the email should it be a multipart style which most are. See: EmailParse.class.php
And last up are some changes to the html2md class which is used during outbound emails. This should improve the link length problem that was discussed in another thread, but while addressing that issue is when I noticed that some changes were needed to the above email parser. So again in sources/subs Html2Md.class.php
Remember to save your old files, just do a rename to .sav and then place these new files in the right directories.