-
-
Notifications
You must be signed in to change notification settings - Fork 81
Description
Description
The problem is that a panic is returned when trying to send a multipart email with attachment.
Version v0.6.2 has the problem while version v0.5.2 is running fine and doesn't have the bug.
The bug can be reproduced with a simplified variant of the invoice.eml file which can be found in "go-mail/testdata
/invoice.eml".
I attached the file to reproduce.
To Reproduce
The steps to reproduce are basically:
- Read the EML file with the mail client (either EMLToMsgFromFile or EMLToMsgFromString). Use attached invoice.txt
- Configure the mail client so email can be sent (authentication, smtp server)
- Try to send the email which originated from the EML file
Create a mail client
`
import (
"fmt"
"log"
"strings"
"github.com/wneessen/go-mail"
)
client, err := mail.NewClient(...)
`
Read the attached eml file
message, err := mail.EMLToMsgFromFile(emlMailPath)
Send the email
mail.DialAndSend(message)
Results in
panic: assignment to entry in nil map ¦
¦ ¦
¦ -> github.com/wneessen/go-mail.(*msgWriter).writeMsg ¦
¦ -> /home/runner/go/pkg/mod/github.com/wneessen/[email protected]/msgwriter.go:143 ¦
¦ ¦
¦ github.com/wneessen/go-mail.(*Msg).WriteTo ¦
¦ /home/runner/go/pkg/mod/github.com/wneessen/[email protected]/msg.go:2243 ¦
¦ github.com/wneessen/go-mail.(*Client).sendSingleMsg ¦
¦ /home/runner/go/pkg/mod/github.com/wneessen/[email protected]/client.go:1442 ¦
¦ github.com/wneessen/go-mail.(*Client).SendWithSMTPClient ¦
¦ /home/runner/go/pkg/mod/github.com/wneessen/[email protected]/client_120.go:56 ¦
¦ github.com/wneessen/go-mail.(*Client).DialAndSendWithContext ¦
¦ /home/runner/go/pkg/mod/github.com/wneessen/[email protected]/client.go:1179 ¦
¦ github.com/wneessen/go-mail.(*Client).DialAndSend ¦
¦ /home/runner/go/pkg/mod/github.com/wneessen/[email protected]/client.go:1152
Expected behaviour
To panic when sending multipart emails. Restore behavior of version v0.5.2
Screenshots
No response
Attempted Fixes
No response
Additional context
No response