-
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 #7 from DarkRockMountain/feature/refactor-provider…
…s-package refactor(providers): separate all email providers into individual packages
- Loading branch information
Showing
33 changed files
with
71 additions
and
68 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
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
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
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
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
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
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 |
---|---|---|
|
@@ -71,7 +71,7 @@ jsonCredentials := []byte(`{ | |
user := "[email protected]" | ||
|
||
// Initialize the GmailEmailSender | ||
emailSender, err := providers.NewGmailEmailSenderJWT(jsonCredentials, user) | ||
emailSender, err := gmail.NewGmailEmailSenderJWT(jsonCredentials, user) | ||
if err != nil { | ||
log.Fatalf("Failed to create GmailEmailSender: %v", err) | ||
} | ||
|
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ jsonCredentials := []byte(`{ | |
user := "[email protected]" | ||
|
||
// Initialize the GmailEmailSender | ||
emailSender, err := providers.NewGmailEmailSenderServiceAccount(jsonCredentials, user) | ||
emailSender, err := gmail.NewGmailEmailSenderServiceAccount(jsonCredentials, user) | ||
if err != nil { | ||
log.Fatalf("Failed to create GmailEmailSender: %v", err) | ||
} | ||
|
@@ -131,7 +131,7 @@ tokenManager := &MyTokenManager{ | |
} | ||
|
||
// Create GmailEmailSender with the parsed credentials and token | ||
emailSender, err := providers.NewGmailEmailSenderOauth2(credentials, tokenManager, "me") | ||
emailSender, err := gmail.NewGmailEmailSenderOauth2(credentials, tokenManager, "me") | ||
if err != nil { | ||
log.Fatalf("Failed to create email sender: %v", err) | ||
} | ||
|
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 |
---|---|---|
|
@@ -72,7 +72,7 @@ jsonCredentials := []byte(`{ | |
user := "[email protected]" | ||
|
||
// Initialize the GmailEmailSender | ||
emailSender, err := providers.NewGmailEmailSenderJWTAccess(jsonCredentials, user) | ||
emailSender, err := gmail.NewGmailEmailSenderJWTAccess(jsonCredentials, user) | ||
if err != nil { | ||
log.Fatalf("Failed to create GmailEmailSender: %v", err) | ||
} | ||
|
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 |
---|---|---|
|
@@ -65,7 +65,7 @@ jsonCredentials := []byte(`{ | |
user := "[email protected]" | ||
|
||
// Initialize the GmailEmailSender | ||
emailSender, err := providers.NewGmailEmailSenderServiceAccount(jsonCredentials, user) | ||
emailSender, err := gmail.NewGmailEmailSenderServiceAccount(jsonCredentials, user) | ||
if err != nil { | ||
log.Fatalf("Failed to create GmailEmailSender: %v", err) | ||
} | ||
|
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
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 |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
// This project is organized into several packages: | ||
// | ||
// - providers: Contains implementations for various email providers. | ||
// - credentials: Contains implementations for managing email credentials. | ||
// - examples: Contains example applications demonstrating how to use the library. | ||
// - docs: Contains documentation for configuring different email providers. | ||
// | ||
|
@@ -22,12 +23,12 @@ | |
// package main | ||
// | ||
// import ( | ||
// "github.com/darkrockmountain/gomail/providers" | ||
// "github.com/darkrockmountain/gomail/providers/sendgrid" | ||
// ) | ||
// | ||
// func main() { | ||
// sender := providers.NewSendGridEmailSender("your-api-key") | ||
// err := sender.SendEmail("[email protected]", "Subject", "Email body") | ||
// sender := sendgrid.NewSendGridEmailSender("your-api-key") | ||
// err := sender.SendEmail(EmailMessage{To:[]string{"[email protected]"}, Subject:"Subject", Text:"Email body"}) | ||
// if err != nil { | ||
// log.Fatal(err) | ||
// } | ||
|
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 |
---|---|---|
|
@@ -17,11 +17,12 @@ | |
// | ||
// import ( | ||
// "github.com/darkrockmountain/gomail" | ||
// "github.com/darkrockmountain/gomail/providers/sendgrid" | ||
// ) | ||
// | ||
// func main() { | ||
// sender := providers.NewSendGridEmailSender("your-api-key") | ||
// err := sender.SendEmail("[email protected]", "Subject", "Email body") | ||
// sender := sendgrid.NewSendGridEmailSender("your-api-key") | ||
// err := sender.SendEmail(EmailMessage{To:[]string{"[email protected]"}, Subject:"Subject", Text:"Email body"}) | ||
// if err != nil { | ||
// log.Fatal(err) | ||
// } | ||
|
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
2 changes: 1 addition & 1 deletion
2
providers/gmail_email_sender_test.go → providers/gmail/gmail_email_sender_test.go
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package providers | ||
package gmail | ||
|
||
import ( | ||
"bytes" | ||
|
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
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
2 changes: 1 addition & 1 deletion
2
providers/mailgun_email_sender.go → providers/mailgun/mailgun_email_sender.go
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package providers | ||
package mailgun | ||
|
||
import ( | ||
"context" | ||
|
2 changes: 1 addition & 1 deletion
2
providers/mailgun_email_sender_test.go → ...ders/mailgun/mailgun_email_sender_test.go
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package providers | ||
package mailgun | ||
|
||
import ( | ||
"context" | ||
|
2 changes: 1 addition & 1 deletion
2
providers/mandrill_email_sender.go → providers/mandrill/mandrill_email_sender.go
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// mandrill_email_sender.go | ||
package providers | ||
package mandrill | ||
|
||
import ( | ||
"bytes" | ||
|
2 changes: 1 addition & 1 deletion
2
providers/mandrill_email_sender_test.go → ...rs/mandrill/mandrill_email_sender_test.go
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package providers | ||
package mandrill | ||
|
||
import ( | ||
"net/http" | ||
|
Oops, something went wrong.