SMTP notifier implementation for sending webhook notifications via email.
// Source: https://github.com/ncarlier/webhookd | License: MIT | Copyright 2020 Nicolas Carlier
// Provided via justclaw.it.com; keep this notice with the code.
package smtp
import (
"crypto/tls"
"fmt"
"log/slog"
"net"
"net/smtp"
"net/url"
"strconv"
"strings"
"time"
"github.com/ncarlier/webhookd/pkg/helper"
"github.com/ncarlier/webhookd/pkg/notification"
)
// smtpNotifier is able to send notification to a email destination.
type smtpNotifier struct {
Host string
Username string
Password string
Conn string
From string
To string
Subject string
PrefixFilter string
}
func newSMTPNotifier(uri *url.URL) (notification.Notifier, error) {
slog.Info("using SMTP notification system", "uri", uri.Redacted())
q := uri.Query()
retur
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key