xhit / go-simple-mail

Golang package for send email. Support keep alive connection, TLS and SSL. Easy for bulk SMTP.
MIT License
650 stars 102 forks source link

Identifying inline attachments with CID instead of name #101

Closed meain closed 7 months ago

meain commented 7 months ago

As of now, the library uses name field to identify inline attachments. As in, it expects the user to have the body in the format <img src="cid:{name} ...> and the attachment to be mail.File{name: <name>}.

This limitation is currently because the fact that we get the contentID based on the name here and also does replaceCIDs on the body.

There are a few drawbacks for this approach:


Proposal for a fix: We can optionally accept CID in mail.File and if a CID is provided, use that instead of name in the code locations I have mentioned earlier. I can send you a PR if you are interested.

xhit commented 7 months ago

Hi, please send a PR with the proposal