mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-23 06:10:48 +01:00
Compare commits
No commits in common. "46cf2ed498215caf739a117caca7d688063c81b7" and "4b60557518ab8f8552c75b1a148200111de29b43" have entirely different histories.
46cf2ed498
...
4b60557518
2 changed files with 4 additions and 13 deletions
|
@ -138,10 +138,6 @@ func (mw *msgWriter) writeMsg(msg *Msg) {
|
|||
if msg.hasMixed() {
|
||||
mw.stopMP()
|
||||
}
|
||||
|
||||
if msg.hasSMime() {
|
||||
mw.stopMP()
|
||||
}
|
||||
}
|
||||
|
||||
// writeGenHeader writes out all generic headers to the msgWriter
|
||||
|
@ -345,7 +341,7 @@ func (mw *msgWriter) writeBody(writeFunc func(io.Writer) (int64, error), encodin
|
|||
encodedWriter = quotedprintable.NewWriter(&writeBuffer)
|
||||
} else if encoding == EncodingB64 && !singingWithSMime {
|
||||
encodedWriter = base64.NewEncoder(base64.StdEncoding, &lineBreaker)
|
||||
} else if encoding == NoEncoding || singingWithSMime {
|
||||
} else if encoding == NoEncoding {
|
||||
_, err = writeFunc(&writeBuffer)
|
||||
if err != nil {
|
||||
mw.err = fmt.Errorf("bodyWriter function: %w", err)
|
||||
|
|
11
sime.go
11
sime.go
|
@ -16,9 +16,6 @@ var (
|
|||
// ErrInvalidKeyPair should be used if key pair is invalid
|
||||
ErrInvalidKeyPair = errors.New("invalid key pair")
|
||||
|
||||
// ErrInvalidCertificate should be used if a certificate is invalid
|
||||
ErrInvalidCertificate = errors.New("invalid certificate")
|
||||
|
||||
// ErrCouldNotInitialize should be used if the signed data could not initialize
|
||||
ErrCouldNotInitialize = errors.New("could not initialize signed data")
|
||||
|
||||
|
@ -49,7 +46,7 @@ func newSMime(keyPair *tls.Certificate) (*SMime, error) {
|
|||
for _, cert := range keyPair.Certificate[1:] {
|
||||
c, err := x509.ParseCertificate(cert)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidCertificate
|
||||
return nil, err
|
||||
}
|
||||
parentCertificates = append(parentCertificates, c)
|
||||
}
|
||||
|
@ -105,10 +102,8 @@ func encodeToPEM(msg []byte) (*string, error) {
|
|||
}
|
||||
|
||||
r := arrayBuffer.String()
|
||||
r = strings.TrimPrefix(r, "-----BEGIN -----")
|
||||
r = strings.Trim(r, "\n")
|
||||
r = strings.TrimSuffix(r, "-----END -----")
|
||||
r = strings.Trim(r, "\n")
|
||||
r = strings.ReplaceAll(r, "-----BEGIN -----\n", "")
|
||||
r = strings.ReplaceAll(r, "-----END -----\n", "")
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue