mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-23 14:10:50 +01:00
Refine WriteToTempFile docstring
Clarify the documentation for WriteToTempFile to better explain its functionality, ensure consistency, and detail its return values.
This commit is contained in:
parent
3333c784a6
commit
0b105048e6
2 changed files with 16 additions and 4 deletions
|
@ -12,8 +12,14 @@ import (
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WriteToTempFile will create a temporary file and output the Msg to this file
|
// WriteToTempFile creates a temporary file and writes the Msg content to this file.
|
||||||
// The method will return the filename of the temporary 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) {
|
func (m *Msg) WriteToTempFile() (string, error) {
|
||||||
f, err := os.CreateTemp("", "go-mail_*.eml")
|
f, err := os.CreateTemp("", "go-mail_*.eml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -12,8 +12,14 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WriteToTempFile will create a temporary file and output the Msg to this file
|
// WriteToTempFile creates a temporary file and writes the Msg content to this file.
|
||||||
// The method will return the filename of the temporary 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) {
|
func (m *Msg) WriteToTempFile() (string, error) {
|
||||||
f, err := ioutil.TempFile("", "go-mail_*.eml")
|
f, err := ioutil.TempFile("", "go-mail_*.eml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue