Skip to content

Commit

Permalink
Refine WriteToTempFile docstring
Browse files Browse the repository at this point in the history
Clarify the documentation for WriteToTempFile to better explain its functionality, ensure consistency, and detail its return values.
  • Loading branch information
wneessen committed Oct 6, 2024
1 parent 3333c78 commit 0b10504
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions msg_totmpfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ import (
"os"
)

// WriteToTempFile will create a temporary file and output the Msg to this file
// The method will return the filename of the temporary file
// WriteToTempFile creates a temporary file and writes the Msg content to this file.
//
// This method generates a temporary file with a ".eml" extension, writes the Msg to it, and returns the
// filename of the created temporary file.
//
// Returns:
// - A string representing the filename of the temporary file.
// - An error if the file creation or writing process fails.
func (m *Msg) WriteToTempFile() (string, error) {
f, err := os.CreateTemp("", "go-mail_*.eml")
if err != nil {
Expand Down
10 changes: 8 additions & 2 deletions msg_totmpfile_116.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ import (
"io/ioutil"
)

// WriteToTempFile will create a temporary file and output the Msg to this file
// The method will return the filename of the temporary file
// WriteToTempFile creates a temporary file and writes the Msg content to this file.
//
// This method generates a temporary file with a ".eml" extension, writes the Msg to it, and returns the
// filename of the created temporary file.
//
// Returns:
// - A string representing the filename of the temporary file.
// - An error if the file creation or writing process fails.
func (m *Msg) WriteToTempFile() (string, error) {
f, err := ioutil.TempFile("", "go-mail_*.eml")
if err != nil {
Expand Down

0 comments on commit 0b10504

Please sign in to comment.