wneessen/go-mail

allow creating html mail with plain text part

lublak opened this issue ยท 4 comments

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

Currently you can create a html mail or a plain text mail.
Without fallback solution.

Describe the solution you'd like

It would be nice to have an option to create a html body with a fallback plain text (for email programs that are not supporting html)

https://gist.github.com/tylermakin/d820f65eb3c9dd98d58721c7fb1939a8

Describe alternatives you've considered

No response

Additional context

No response

Pretty sure this is already possible I'm out at the moment but will show code in about 40 mins if someone else doesn't

@james-d-elliott is right. You can accomplish that with the AddAlternative* methods. You assign a main body part and an alternative body part.

A full example, using the Template methods can be found in the bulk mailer example on the go-mail website:
https://go-mail.dev/examples/bulk-mailer/#hl-0-86

Damn, I forgot about this, thanks Winni.

@wneessen thanks :) i will try it out!