darkrockmountain / gomail

GoMail is a powerful library for sending emails via multiple providers, including SMTP, Gmail API, Microsoft Graph API, SendGrid, AWS SES, Mailgun, Mandrill, Postmark, and SparkPost. Supporting attachments, plain text, and HTML content, it simplifies email integration for developers with easy setup and robust functionalities.
https://darkrockmountain.com
Apache License 2.0
4 stars 1 forks source link
aws-lambda aws-ses azure-functions email email-sender email-sending gmail gmail-api go golang google-cloud-functions mailgun mandrill microsoft-graph-api msexchange postmark sendgrid smtp sparkpost

GoMail - Email Sender Library

Build Status GoDoc Go Report Card codecov Vulnerability assessment Status FOSSA Status FOSSA Status OpenSSF Scorecard GitHub Release

Project Description

This project provides implementations for sending emails using different services including SMTP, Gmail API, Microsoft Graph API, SendGrid, AWS SES, Mailgun, Mandrill, Postmark, and SparkPost. Each implementation follows a common interface, allowing for flexibility and easy integration with various email services.

Features

Getting Started

Prerequisites

Download

go get github.com/darkrockmountain/gomail 
go mod tidy

Usage

1. SMTP Email Sender

2. Gmail Email Sender

3. Gmail Email Sender using OAuth2

4. Microsoft 365 Email Sender

5. SendGrid Email Sender

6. AWS SES Email Sender

7. Mailgun Email Sender

8. Mandrill Email Sender

9. Postmark Email Sender

10. SparkPost Email Sender

Documentation

For detailed instructions on obtaining the necessary credentials for each implementation, refer to the respective documentation files in the docs directory.

License

This project is licensed under the Apache-2.0 License - see the LICENSE file for details.

Error Handling and Troubleshooting

Common Errors

Troubleshooting Tips

  1. Check Logs: Always check your application logs for detailed error messages.
  2. Validate Credentials: Double-check your credentials and permissions.
  3. API Limits: Ensure you are not exceeding API rate limits or quotas.
  4. Service Status: Verify that the email service provider is operational and not experiencing downtime.

Security Best Practices

  1. Environment Variables: Use environment variables to store credentials.
  2. Secret Managers: Use secret management services like AWS Secrets Manager, Google Secret Manager, or HashiCorp Vault.
  3. Encryption: Encrypt sensitive information both at rest and in transit.
  4. Least Privilege: Follow the principle of least privilege for API keys and credentials.