postmoogle/vendor/github.com/jhillyerd/enmime/v2/encoder_options.go
2025-06-24 10:57:16 +03:00

33 lines
729 B
Go

package enmime
type EncoderOption interface {
apply(p *Encoder)
}
// Encoder implements MIME part encoding options
type Encoder struct {
forceQuotedPrintableCteOption bool
}
// ForceQuotedPrintableCte forces "quoted-printable" transfer encoding when selecting Content Transfer Encoding, preventing the use of base64.
func ForceQuotedPrintableCte(b bool) EncoderOption {
return forceQuotedPrintableCteOption(b)
}
type forceQuotedPrintableCteOption bool
func (o forceQuotedPrintableCteOption) apply(p *Encoder) {
p.forceQuotedPrintableCteOption = bool(o)
}
func NewEncoder(ops ...EncoderOption) *Encoder {
e := Encoder{
forceQuotedPrintableCteOption: false,
}
for _, o := range ops {
o.apply(&e)
}
return &e
}