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

How to set Content-ID to attached file? #144

Closed
dmitam opened this issue Aug 24, 2023 · 2 comments
Closed

How to set Content-ID to attached file? #144

dmitam opened this issue Aug 24, 2023 · 2 comments

Comments

@dmitam
Copy link

dmitam commented Aug 24, 2023

Is your feature request related to a problem? Please describe.

I need to set Content-ID to use attached image inside the html content. I tried to SetGenHeader on message but it affects all the parts.
Seems to be related with #107

Describe the solution you'd like

Another option WithContentId or WithHeader in EmbedFile or AttachFile

Describe alternatives you've considered

No response

Additional context

No response

@dmitam dmitam added the enhancement New feature or request label Aug 24, 2023
@wneessen
Copy link
Owner

Hi @dmitam,

thanks for opening this report. You can actually already do the requested feature with go-mail right now.

Embed your image file like this:

m := mail.NewMsg()
[...]
m.EmbedFile(fn, mail.WithFileName("my_logo.png"))

and in the mail body, then refer to the filename via the oid: keyword:

<img src="cid:my_logo.png" alt="My great Logo" width="150px"/>

The mail client will then inline the logo as expected directly into the mail's html context.

@wneessen wneessen removed the enhancement New feature or request label Aug 24, 2023
@dmitam
Copy link
Author

dmitam commented Aug 24, 2023

Thank you! It helped

@dmitam dmitam closed this as completed Aug 24, 2023
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

2 participants