Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong content_type_t when adding an attachment #28

Closed
david-antiteum opened this issue Feb 29, 2020 · 8 comments
Closed

Wrong content_type_t when adding an attachment #28

david-antiteum opened this issue Feb 29, 2020 · 8 comments

Comments

@david-antiteum
Copy link
Contributor

If an email has content in HTML and then an attachment, the content losses the type.

  • In message::attach it overwrites the attribute _content_type
  • In message::format it sets the content as text/plain
@niclar
Copy link

niclar commented Feb 5, 2021

@karastojko this is still an issue

@karastojko
Copy link
Owner

karastojko commented Feb 5, 2021

@niclar
This PR is not merged because there was another issue not solved with this change. There was a commit which tries to fix two defects. Did you try
void attach(const std::istream&, const std::string&, media_type_t, const std::string&)
or
void attach(const std::list<std::tuple<std::istream&, std::string, content_type_t>>&) ?

@niclar
Copy link

niclar commented Feb 9, 2021

@karastojko attach(const std::istream&, const std::string&, media_type_t, const std::string&) seems broken in my use case below.
void attach(const std::list<std::tuple<std::istream&, std::string, content_type_t>>&) however seems to work. Thanks.

msg.content_type(mailio::mime::content_type_t(mailio::mime::media_type_t::TEXT, "html", "utf-8"));
msg.content(content);
msg.content_transfer_encoding(mailio::mime::content_transfer_encoding_t::QUOTED_PRINTABLE);

//msg.attach(attachmentStream, attachmentName, mailio::mime::media_type_t::TEXT, "csv"); <--- destroys the content encoding above
msg.attach({{attachmentStream, attachmentName, mailio::mime::content_type_t(mailio::mime::media_type_t::TEXT, "csv", "utf-8")}});    

@karastojko
Copy link
Owner

@niclar
The attach(const std::istream&, const std::string&, media_type_t, const std::string&) is broken and will be deprecated. This PR is not closed since it contains the vcpkg port which will be included.

@niclar
Copy link

niclar commented Feb 9, 2021

@karastojko re vcpkg. -I did a local one a while back. -Can you expose static lib building something along the line of (or should I create a PR) ? ;

vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS -DMAILIO_BUILD_SHARED_LIBRARY:BOOL=OFF)

@niclar
Copy link

niclar commented Feb 9, 2021

-ah I see that this branch may address that as well.
Awaiting the merge then. Great lib.

@david-antiteum
Copy link
Contributor Author

@niclar have a look at #39

@david-antiteum
Copy link
Contributor Author

OK, as the issue is fixed using void attach(const std::list<std::tuple<std::istream&, std::string, content_type_t>>&) I will add a new PR just for vcpkg issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants