Skip to content

Commit

Permalink
Merge pull request #16 from DarkRockMountain/bugfix/update-go-1.22.4
Browse files Browse the repository at this point in the history
feat(email_message): encapsulate EmailMessage and Attachment struct with private fields and add constructors
  • Loading branch information
DarkRockMountain-admin authored Jun 7, 2024
2 parents 2f1f56b + 79072a0 commit ea2dc99
Show file tree
Hide file tree
Showing 35 changed files with 1,044 additions and 380 deletions.
2 changes: 1 addition & 1 deletion .examples/.serverless/aws_lambda/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/darkrockmountain/gomail/aws_lambda_email_sender

go 1.22.1
go 1.22.4

require (
github.com/aws/aws-lambda-go v1.47.0
Expand Down
2 changes: 1 addition & 1 deletion .examples/.serverless/azure_functions/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/darkrockmountain/gomail/azure_email_sender

go 1.22.1
go 1.22.4

require github.com/darkrockmountain/gomail v0.5.1
2 changes: 1 addition & 1 deletion .examples/.serverless/google_cloud_functions/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/darkrockmountain/gomail/google_cloud_email_sender

go 1.22.1
go 1.22.4

require (
github.com/GoogleCloudPlatform/functions-framework-go v1.8.1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: 1.22.3
go-version: 1.22.4

- name: Install dependencies
run: go mod tidy
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: 1.22.3
go-version: 1.22.4

- name: Run tests and generate coverage
run: go test -coverprofile=coverage.out ./...
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/govulncheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ jobs:
- id: govulncheck
uses: golang/govulncheck-action@3a32958c2706f7048305d5a2e53633d7e37e97d0 # v1.0.2
with:
go-version-input: 1.22.3
go-version-input: 1.22.4
go-package: ./...
4 changes: 1 addition & 3 deletions docs/AWS_SES_Credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ if err != nil {
// Define email message
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,
})
AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))



Expand Down
4 changes: 1 addition & 3 deletions docs/Gmail_Credentials_API_Key.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ if err != nil {

// Define email message using an alias email address
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))



Expand Down
4 changes: 1 addition & 3 deletions docs/Gmail_Credentials_JWT.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ if err != nil {

// Define email message using an alias email address
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))

// Send email
if err := emailSender.SendEmail(message); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions docs/Gmail_Credentials_OAuth2.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ if err != nil {

// Define email message using an alias email address
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))

// Send email
if err := emailSender.SendEmail(message); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions docs/Gmail_Credentials_ServiceAccount copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ if err != nil {

// Define email message using an alias email address
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))

// Send email
if err := emailSender.SendEmail(message); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions docs/Gmail_Credentials_ServiceAccount.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ if err != nil {

// Define email message using an alias email address
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))

// Send email
if err := emailSender.SendEmail(message); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions docs/Mailgun_Credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ if err != nil {

// Define email message
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))

// Send email
if err := emailSender.SendEmail(message); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions docs/Mandrill_Credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ if err != nil {

// Define email message
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))

// Send email
if err := emailSender.SendEmail(message); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions docs/Microsoft365_Credentials_ROPC.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ if err != nil {

// Define email message
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))

// Send email
if err := emailSender.SendEmail(message); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions docs/Microsoft365_Credentials_app.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ if err != nil {

// Define email message
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))

// Send email
if err := emailSender.SendEmail(message); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions docs/Microsoft365_Credentials_credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ if err != nil {

// Define email message
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))

// Send email
if err := emailSender.SendEmail(message); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions docs/Microsoft365_Credentials_managed_id.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ if err != nil {

// Define email message
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))

// Send email
if err := emailSender.SendEmail(message); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions docs/Microsoft365_Credentials_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ if err != nil {

// Define email message
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))

// Send email
if err := emailSender.SendEmail(message); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions docs/Postmark_Credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ if err != nil {

// Define email message
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))

// Send email
if err := emailSender.SendEmail(message); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions docs/SMTP_Credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ if err != nil {

// Define email message
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))

// Send email
if err := emailSender.SendEmail(message); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions docs/SendGrid_Credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ if err != nil {

// Define email message
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,
})
SetHTML("<p>This is the <b>HTML</b> part of the <i>email</i>.</p>").AddAttachments(*gomail.NewAttachment("attachment.jpg", attachmentContent))

// Send email
if err := emailSender.SendEmail(message); err != nil {
Expand Down
Loading

0 comments on commit ea2dc99

Please sign in to comment.