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

Add Encode(io.Writer) method to enmime.Envelope #7

Closed
jhillyerd opened this issue Nov 30, 2016 · 6 comments
Closed

Add Encode(io.Writer) method to enmime.Envelope #7

jhillyerd opened this issue Nov 30, 2016 · 6 comments

Comments

@jhillyerd
Copy link
Owner

jhillyerd commented Nov 30, 2016

Implement the ability to create an email with enmime.

Envelope.Encode() should write out a well formed MIME email, providing the Envelope and its associate parts are properly configured.

Other work will need to be done, such as generating unique MIME part boundary strings.

jhillyerd added a commit that referenced this issue Jan 8, 2018
Part content readers make everything more complicated for no benefit.
See #37, #38, #45.  They also prevent some errors from being surfaced
in the Part object, as they haven't been detected at the time it is
returned to the client.

Part.Content []byte is now the recommended way to access the content of
a Part.  Part.Content will also be used when generating MIME emails,
for #7.
@jhillyerd
Copy link
Owner Author

Blocked on #50

@jhillyerd
Copy link
Owner Author

Now that Part encoding (#50) is almost finished, I've been giving this some more thought. enmime.Envelope itself doesn't add much value in terms of creating a new message, the user still has to manipulate headers directly.

It makes more sense just to implement a fluent builder.

dcormier pushed a commit to dcormier/enmime that referenced this issue Nov 16, 2018
@bronger
Copy link

bronger commented Mar 3, 2021

I need to read an email from a file, manipulate it, and send it. AFAICS, this is not possible with enmime because the Envelope wouldn’t send and the Builder wouldn’t read, and there is no converter between them, right?

@jhillyerd
Copy link
Owner Author

Not yet. #158 is tracking a feature along these lines.

@bronger
Copy link

bronger commented Mar 3, 2021

myEnvelope.Root.Encode() looks pretty much like the mail that I read from the file (apart from ordering of headers). Is it truly equivalent?

@jhillyerd
Copy link
Owner Author

That should be close, enmime may convert other charsets to UTF-8. But essentially my plan is to update Envelope header manipulation methods to also update that Root part, and leverage Encode() to send the message.

If you do run into any issues, maybe add them to #158 so I keep them in mind when implementing.

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

No branches or pull requests

2 participants