You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mime::parts() returns the parts of a multipart message by value.
I'm only just trying mailio for the first time (having been using a different package up until now) - so maybe there's another approach I should be using, but not seen one so far.
But by returning by value, as far as I can tell this then makes it difficult for me to edit a part within a message. I'd need to make a copy of it, remove the original, and then add it back in again, which I'm concerned would have ramifications for the rest of the message. I'm looking to modify the HTML of a message body, whilst leaving things like attachments as they are. Even if I tried to copy-construct a copy of the original message and work with that, as I recurse through any subparts I'm still getting a copy of those parts back. So I think I would need to construct my own tree and then start at the leaves and add new parts back into parents recursively in order to work around this.
Perhaps this is by design due to the link to the original message as parsed, I'm not sure. But if there would be a way to make edits to just one part, that'd be a helpful feature to add to achieve what I'm trying to do.
I assume returning by (const) reference in parts() would break API compatibility for existing projects - but would a function similar to this perhaps with a different name be physically possible to enable modifications of the content or headers of an existing part within a message body?
Thanks.
The text was updated successfully, but these errors were encountered:
I believe such possibility could be added. Currently there is void mime::add_part(const mime&) but indeed a specific part cannot be edited. So, do you suggest to add few more operations like void mime::update_part(const mime& part) (update based on the content id) and void mime::delete_part(const string& content_id) or maybe to return a reference with a method like mime& mime::part(const string& content_id) ?
That makes sense to me. I have been using mimesis too, and this generally returns parts by reference/pointer (or reference to the container of these), so any modifications I make can be written out, which has been convenient. But again, this may break the API for users of mailio. So I think update_part and delete_part, or fetching one by its ID as you say both sound very reasonable to me.
Hi,
mime::parts()
returns the parts of a multipart message by value.I'm only just trying mailio for the first time (having been using a different package up until now) - so maybe there's another approach I should be using, but not seen one so far.
But by returning by value, as far as I can tell this then makes it difficult for me to edit a part within a message. I'd need to make a copy of it, remove the original, and then add it back in again, which I'm concerned would have ramifications for the rest of the message. I'm looking to modify the HTML of a message body, whilst leaving things like attachments as they are. Even if I tried to copy-construct a copy of the original message and work with that, as I recurse through any subparts I'm still getting a copy of those parts back. So I think I would need to construct my own tree and then start at the leaves and add new parts back into parents recursively in order to work around this.
Perhaps this is by design due to the link to the original message as parsed, I'm not sure. But if there would be a way to make edits to just one part, that'd be a helpful feature to add to achieve what I'm trying to do.
I assume returning by (const) reference in
parts()
would break API compatibility for existing projects - but would a function similar to this perhaps with a different name be physically possible to enable modifications of the content or headers of an existing part within a message body?Thanks.
The text was updated successfully, but these errors were encountered: