-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50133b8
commit 83dff18
Showing
4 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters