Sends email via AWS SES or SMTP, exposing SendEmailViaSES and sendEmailViaSMTP for delivery.
// Source: https://github.com/plandex-ai/plandex | License: MIT | Copyright 2025 PlandexAI Inc
// Provided via justclaw.it.com; keep this notice with the code.
package email
import (
"fmt"
"net/smtp"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ses"
)
// SendEmailViaSES sends an email using AWS SES
func SendEmailViaSES(recipient, subject, htmlBody, textBody string) error {
sess, err := session.NewSession()
if err != nil {
return fmt.Errorf("error creating AWS session: %v", err)
}
// Create an SES session.
svc := ses.New(sess)
// Assemble the email.
input := &ses.SendEmailInput{
Destination: &ses.Destination{
ToAddresses: []*string{
aws.String(recipient),
},
},
Message: &ses.Message{
Bo
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key