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

Suggestion: make contentType enum public #62

Closed yusufozturk closed 2 years ago

yusufozturk commented 2 years ago

First of all, thank you for this great library.

If you can make mail.contentType enum public, we can hold plain text or html formats in enum instead of integer values.

Right now, we do:

// Check Content Type
if message.ContentType == 1 {
  // Set Body HTML String
  email.SetBody(mail.TextHTML, message.Body)
} else {
  // Set Body Plain String
  email.SetBody(mail.TextPlain, message.Body)
}

What I want to do, is setting message.ContentType as mail.ContentType, so I can use directly:

email.SetBody(message.ContentType, message.Body)

If you accept this suggestion, I can prepare a PR.

Thanks.

xhit commented 2 years ago

You are right, as a breaking change, you can make a PR where destination is V3.

Thanks

Edit: nevermind, is not a breaking change

yusufozturk commented 2 years ago

@xhit opened the PR.

I made the changes with "Rename Symbol", so everything should be okay. Also did some basic tests like sending email, nothing is broken.

Thanks.

xhit commented 2 years ago

Done, thanks for the contribution!