mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-31 14:12:03 +08:00

* feat(emailing): initial commit for emailing * feat(emailing): implement emailing * test(integration): fix tests * fix(emailing): fix directory path * fix(emailing): fix email template path * fix(emailing): copy from go-gomail * fix(emailing): copy from go-gomail * fix(emailing): fix smtp bugs * test(integration): fix tests * feat(emailing): let missing templates passthrough * feat(emailing): let missing templates passthrough * feat(smtp): refactor and beautify * test(integration): fix tests * docs(smtp): fix incorrect grammer * feat(smtp): add to header * feat(smtp): remove comments * chore(smtp): address comments --------- Co-authored-by: Vikrant Gupta <vikrant@signoz.io>
30 lines
977 B
Go
30 lines
977 B
Go
package noopemailing
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/SigNoz/signoz/pkg/emailing"
|
|
"github.com/SigNoz/signoz/pkg/factory"
|
|
"github.com/SigNoz/signoz/pkg/types/emailtypes"
|
|
)
|
|
|
|
type provider struct {
|
|
settings factory.ScopedProviderSettings
|
|
}
|
|
|
|
func NewFactory() factory.ProviderFactory[emailing.Emailing, emailing.Config] {
|
|
return factory.NewProviderFactory(factory.MustNewName("noop"), New)
|
|
}
|
|
|
|
func New(ctx context.Context, providerSettings factory.ProviderSettings, config emailing.Config) (emailing.Emailing, error) {
|
|
settings := factory.NewScopedProviderSettings(providerSettings, "github.com/SigNoz/signoz/pkg/emailing/noopemailing")
|
|
return &provider{
|
|
settings: settings,
|
|
}, nil
|
|
}
|
|
|
|
func (provider *provider) SendHTML(ctx context.Context, to string, subject string, templateName emailtypes.TemplateName, data map[string]any) error {
|
|
provider.settings.Logger().WarnContext(ctx, "using noop provider, no email will be sent", "to", to, "subject", subject)
|
|
return nil
|
|
}
|