-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from DarkRockMountain/feature/encapsulate-emai…
…l-message refactor(email_sender): encapsulate EmailMessage struct
- Loading branch information
Showing
30 changed files
with
799 additions
and
646 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,14 +44,13 @@ if err != nil { | |
} | ||
|
||
// Define email message | ||
message := gomail.EmailMessage{ | ||
From: sender, | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with attachment", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage(sender,[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>"). | ||
AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
|
||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -43,14 +43,12 @@ if err != nil { | |
} | ||
|
||
// Define email message using an alias email address | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with Alias", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
|
||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -83,14 +83,10 @@ if err != nil { | |
} | ||
|
||
// Define email message using an alias email address | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with Alias", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -143,14 +143,10 @@ if err != nil { | |
} | ||
|
||
// Define email message using an alias email address | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with Alias", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -84,14 +84,10 @@ if err != nil { | |
} | ||
|
||
// Define email message using an alias email address | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with Alias", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -77,14 +77,10 @@ if err != nil { | |
} | ||
|
||
// Define email message using an alias email address | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with Alias", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -41,14 +41,10 @@ if err != nil { | |
} | ||
|
||
// Define email message | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with attachment", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -37,14 +37,10 @@ if err != nil { | |
} | ||
|
||
// Define email message | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with attachment", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -51,14 +51,10 @@ if err != nil { | |
} | ||
|
||
// Define email message | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with attachment", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -51,14 +51,10 @@ if err != nil { | |
} | ||
|
||
// Define email message | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with attachment", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -50,14 +50,10 @@ if err != nil { | |
} | ||
|
||
// Define email message | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with attachment", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -38,14 +38,10 @@ if err != nil { | |
} | ||
|
||
// Define email message | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with attachment", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -51,14 +51,10 @@ if err != nil { | |
} | ||
|
||
// Define email message | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with attachment", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -39,14 +39,10 @@ if err != nil { | |
} | ||
|
||
// Define email message | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with attachment", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -44,14 +44,10 @@ if err != nil { | |
} | ||
|
||
// Define email message | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with attachment", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
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 |
---|---|---|
|
@@ -36,14 +36,10 @@ if err != nil { | |
} | ||
|
||
// Define email message | ||
message := gomail.EmailMessage{ | ||
From: "[email protected]", | ||
To: []string{"[email protected]"}, | ||
Subject: "Test Email with attachment", | ||
Text: "This is the plain text part of the email.", | ||
HTML: "<p>This is the <b>HTML</b> part of the <i>email</i>.</p>", | ||
Attachments: []gomail.Attachment{{Filename: "attachment.jpg", Content: attachmentContent}}, | ||
} | ||
message := *gomail.NewEmailMessage("[email protected]",[]string{"[email protected]"}, "Test Email with attachment", "This is the plain text part of the email."). | ||
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(gomail.Attachment{ | ||
Filename: "attachment.jpg", Content: attachmentContent, | ||
}) | ||
|
||
// Send email | ||
if err := emailSender.SendEmail(message); err != nil { | ||
|
Oops, something went wrong.