You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ya...@apache.org on 2026/10/08 05:25:03 UTC
(airavata-custos) branch master updated: Email Notification Connector (#606)
This is an automated email from the ASF dual-hosted git repository.
yasithdev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git
The following commit(s) were added to refs/heads/master by this push:
new a103f97d9 Email Notification Connector (#606)
a103f97d9 is described below
commit a103f97d939d6c622e09762d68d82d9d9343003f
Author: Lahiru Jayathilake <la...@gmail.com>
AuthorDate: Thu Oct 8 01:24:57 2026 -0400
Email Notification Connector (#606)
* Publish the provision event once the cluster account exists in the registry and VAST now listens to the provision event
* Add email-notifier connector with the templates for account pending, approval, and denial
---
.env.example | 12 ++
config/custos.yaml | 15 ++
connectors/Notification/Email/README.md | 38 +++++
.../Email/internal/notify/live_send_test.go | 56 +++++++
.../Notification/Email/internal/notify/notifier.go | 135 +++++++++++++++
.../internal/notify/notifier_integration_test.go | 144 ++++++++++++++++
.../Email/internal/notify/notifier_test.go | 182 +++++++++++++++++++++
.../Notification/Email/internal/notify/render.go | 88 ++++++++++
.../Email/internal/notify/render_test.go | 50 ++++++
.../Notification/Email/internal/notify/smtp.go | 69 ++++++++
.../notify/templates/account-ready.html.tmpl | 74 +++++++++
.../notify/templates/account-ready.txt.tmpl | 41 +++++
.../internal/notify/templates/layout.html.tmpl | 116 +++++++++++++
.../notify/templates/request-denied.html.tmpl | 53 ++++++
.../notify/templates/request-denied.txt.tmpl | 38 +++++
.../notify/templates/request-received.html.tmpl | 42 +++++
.../notify/templates/request-received.txt.tmpl | 38 +++++
connectors/Notification/Email/pkg/email/loader.go | 83 ++++++++++
go.mod | 10 +-
go.sum | 20 ++-
internal/connectors/loader.go | 2 +
web/public/brand/logo/custos-mark.png | Bin 0 -> 8380 bytes
22 files changed, 1294 insertions(+), 12 deletions(-)
diff --git a/.env.example b/.env.example
index c21c42776..7346a0300 100644
--- a/.env.example
+++ b/.env.example
@@ -79,3 +79,15 @@ VAST_VMS_URL=
VAST_API_USER=
VAST_API_PASSWORD=
VAST_TENANT_ID=
+
+# --- Email notification connector ----------------------------------------
+
+EMAIL_SMTP_HOST=
+EMAIL_SMTP_USERNAME=
+EMAIL_SMTP_PASSWORD=
+EMAIL_FROM=
+EMAIL_SUPPORT=
+EMAIL_SITE_NAME=
+EMAIL_PORTAL_URL=
+EMAIL_CLUSTER_HOST=
+EMAIL_LOGO_URL=
diff --git a/config/custos.yaml b/config/custos.yaml
index aec6cca66..686747820 100644
--- a/config/custos.yaml
+++ b/config/custos.yaml
@@ -139,3 +139,18 @@ connectors:
analytics:
type: "analytics"
enabled: true
+
+ email-notifier:
+ type: "email-notifier"
+ enabled: true
+ smtp_host: "${EMAIL_SMTP_HOST}"
+ smtp_port: 587
+ username: "${EMAIL_SMTP_USERNAME}"
+ password: "${EMAIL_SMTP_PASSWORD}"
+ from: "${EMAIL_FROM}"
+ support_email: "${EMAIL_SUPPORT}"
+ site_name: "${EMAIL_SITE_NAME}"
+ portal_url: "${EMAIL_PORTAL_URL}"
+ cluster_host: "${EMAIL_CLUSTER_HOST}"
+ # A square PNG. Defaults to the portal's /brand/logo/custos-mark.png.
+ logo_url: "${EMAIL_LOGO_URL}"
diff --git a/connectors/Notification/Email/README.md b/connectors/Notification/Email/README.md
new file mode 100644
index 000000000..522583253
--- /dev/null
+++ b/connectors/Notification/Email/README.md
@@ -0,0 +1,38 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+# Email Notifier
+
+Emails users about their cluster account: when a request is received,
+when the account is ready, and when a request is denied. Settings are in the
+`email-notifier` block of `config/custos.yaml`.
+
+## Send the emails to your inbox
+
+`internal/notify/live_send_test.go` sends all three emails with sample data
+through a real mail server, so you can check how they look in a real inbox.
+It only runs with the `livemail` tag and when `EMAIL_TEST_TO` is set.
+
+Set the `EMAIL_*` values in `.env`, plus `EMAIL_TEST_TO` with your address,
+then run from the repo root:
+
+```sh
+set -a && . ./.env && set +a
+go test -tags livemail -run TestLiveSend -v ./connectors/Notification/Email/internal/notify/
+```
diff --git a/connectors/Notification/Email/internal/notify/live_send_test.go b/connectors/Notification/Email/internal/notify/live_send_test.go
new file mode 100644
index 000000000..544e46d32
--- /dev/null
+++ b/connectors/Notification/Email/internal/notify/live_send_test.go
@@ -0,0 +1,56 @@
+//go:build livemail
+
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package notify
+
+import (
+ "context"
+ "os"
+ "testing"
+)
+
+// Sends all three emails to the defined EMAIL_TEST_TO address.
+func TestLiveSend(t *testing.T) {
+ to := os.Getenv("EMAIL_TEST_TO")
+ if to == "" {
+ t.Skip("EMAIL_TEST_TO not set")
+ }
+ sender, err := NewSMTP(os.Getenv("EMAIL_SMTP_HOST"), 587, os.Getenv("EMAIL_SMTP_USERNAME"), os.Getenv("EMAIL_SMTP_PASSWORD"), os.Getenv("EMAIL_FROM"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ d := Data{
+ Site: Site{SiteName: os.Getenv("EMAIL_SITE_NAME"), PortalURL: os.Getenv("EMAIL_PORTAL_URL"), ClusterHost: os.Getenv("EMAIL_CLUSTER_HOST"), SupportEmail: os.Getenv("EMAIL_SUPPORT"), LogoURL: os.Getenv("EMAIL_LOGO_URL")},
+ FirstName: "John",
+ Username: "jdoe",
+ Source: "ACCESS",
+ ProjectNumber: "CIS250123",
+ Reason: "We could not confirm an active allocation for this project.",
+ }
+ for _, name := range []string{RequestReceived, AccountReady, RequestDenied} {
+ msg, err := Render(name, d)
+ if err != nil {
+ t.Fatal(err)
+ }
+ msg.To = to
+ if err := sender.Send(context.Background(), msg); err != nil {
+ t.Fatalf("%s: %v", name, err)
+ }
+ }
+}
diff --git a/connectors/Notification/Email/internal/notify/notifier.go b/connectors/Notification/Email/internal/notify/notifier.go
new file mode 100644
index 000000000..5de55c5c7
--- /dev/null
+++ b/connectors/Notification/Email/internal/notify/notifier.go
@@ -0,0 +1,135 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Package notify emails researchers about their cluster account.
+package notify
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "log/slog"
+ "strings"
+
+ "github.com/apache/airavata-custos/pkg/events"
+ "github.com/apache/airavata-custos/pkg/models"
+ "github.com/apache/airavata-custos/pkg/service"
+)
+
+// AuditNotificationSent is written once per email.
+const AuditNotificationSent = "NOTIFICATION_SENT"
+
+// Notifier sends one email per handled event, so retrying a failed delivery resends exactly that email.
+type Notifier struct {
+ core service.CoreService
+ sender Sender
+ site Site
+ source string
+}
+
+func NewNotifier(core service.CoreService, sender Sender, site Site) *Notifier {
+ return &Notifier{core: core, sender: sender, site: site}
+}
+
+// RegisterSubscribers subscribes the handlers.
+func (n *Notifier) RegisterSubscribers(bus *events.Bus, subscriber string) {
+ n.source = subscriber
+ bus.SubscribeComputeClusterUserCreated(subscriber, n.requestReceived)
+ bus.SubscribeComputeClusterUserProvisioned(subscriber, n.accountReady)
+ bus.SubscribeComputeClusterUserDenied(subscriber, n.requestDenied)
+}
+
+// requestReceived emails that Custos received a cluster account creation request and it is pending on an admin.
+func (n *Notifier) requestReceived(ctx context.Context, cu models.ComputeClusterUser) error {
+ if cu.ApprovalStatus != models.ClusterAccountPending {
+ return nil
+ }
+ return n.send(ctx, RequestReceived, cu)
+}
+
+// accountReady emails that Custos provisioned a cluster account for a user.
+func (n *Notifier) accountReady(ctx context.Context, cu models.ComputeClusterUser) error {
+ return n.send(ctx, AccountReady, cu)
+}
+
+// requestDenied emails that Custos admin denied a cluster account creation request.
+func (n *Notifier) requestDenied(ctx context.Context, cu models.ComputeClusterUser) error {
+ return n.send(ctx, RequestDenied, cu)
+}
+
+func (n *Notifier) send(ctx context.Context, name string, cu models.ComputeClusterUser) error {
+ user, err := n.core.GetUser(ctx, cu.UserID)
+ if err != nil {
+ return fmt.Errorf("look up user %s: %w", cu.UserID, err)
+ }
+ if user.Email == "" {
+ return fmt.Errorf("%w: user %s has no email", events.ErrPermanent, user.ID)
+ }
+ project, err := n.project(ctx, cu)
+ if err != nil {
+ return fmt.Errorf("look up project for user %s: %w", cu.UserID, err)
+ }
+
+ d := Data{Site: n.site, FirstName: user.FirstName, Username: cu.LocalUsername}
+ if project != nil {
+ d.Source = strings.ToUpper(project.Origination)
+ d.ProjectNumber = project.OriginatedID
+ }
+ if cu.ReviewNote != nil {
+ d.Reason = *cu.ReviewNote
+ }
+ msg, err := Render(name, d)
+ if err != nil {
+ return fmt.Errorf("%w: render %s: %v", events.ErrPermanent, name, err)
+ }
+ msg.To = user.Email
+ if err := n.sender.Send(ctx, msg); err != nil {
+ return fmt.Errorf("send %s to %s: %w", name, user.Email, err)
+ }
+
+ // The email is already out, so a failed audit write is logged and not returned.
+ details, _ := json.Marshal(map[string]string{"channel": "email", "template": name, "recipient": user.Email})
+ if _, err := n.core.CreateAuditEvent(ctx, &models.AuditEvent{
+ EventType: AuditNotificationSent,
+ EntityID: cu.ID,
+ EntityType: "compute_cluster_user",
+ Details: string(details),
+ Source: n.source,
+ }); err != nil {
+ slog.WarnContext(ctx, "email sent but not audited", "template", name, "compute_cluster_user_id", cu.ID, "error", err)
+ }
+ return nil
+}
+
+// project finds the project the account was requested for.
+// The first allocation on the cluster is the one requested because the cluster account is created only on the user's first request.
+func (n *Notifier) project(ctx context.Context, cu models.ComputeClusterUser) (*models.Project, error) {
+ memberships, err := n.core.ListAllocationsForUser(ctx, cu.UserID)
+ if err != nil {
+ return nil, err
+ }
+ for _, m := range memberships {
+ allocation, err := n.core.GetComputeAllocation(ctx, m.ComputeAllocationID)
+ if err != nil {
+ return nil, err
+ }
+ if allocation.ComputeClusterID == cu.ComputeClusterID {
+ return n.core.GetProject(ctx, allocation.ProjectID)
+ }
+ }
+ return nil, nil
+}
diff --git a/connectors/Notification/Email/internal/notify/notifier_integration_test.go b/connectors/Notification/Email/internal/notify/notifier_integration_test.go
new file mode 100644
index 000000000..29c0880f0
--- /dev/null
+++ b/connectors/Notification/Email/internal/notify/notifier_integration_test.go
@@ -0,0 +1,144 @@
+//go:build integration
+
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package notify
+
+import (
+ "context"
+ "os"
+ "slices"
+ "sync"
+ "testing"
+ "time"
+
+ "github.com/google/uuid"
+
+ "github.com/apache/airavata-custos/internal/db"
+ "github.com/apache/airavata-custos/pkg/events"
+ "github.com/apache/airavata-custos/pkg/models"
+ "github.com/apache/airavata-custos/pkg/service"
+)
+
+// syncRelay is a mockRelay the event worker can call from its own goroutine.
+type syncRelay struct {
+ mu sync.Mutex
+ sent []string
+}
+
+func (r *syncRelay) Send(_ context.Context, m Message) error {
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ r.sent = append(r.sent, m.To+" | "+m.Subject)
+ return nil
+}
+
+func (r *syncRelay) count() int {
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ return len(r.sent)
+}
+
+// Make sure for each account event: pending, ready, and denied an email is sent only once.
+func TestNotifier_SendsOneEmailPerAccountEvent(t *testing.T) {
+ dsn := os.Getenv("CORE_TEST_DATABASE_DSN")
+ if dsn == "" {
+ t.Skip("integration env not set: CORE_TEST_DATABASE_DSN required")
+ }
+ database, err := db.Open(db.Config{DSN: dsn, MaxOpenConns: 5, MaxIdleConns: 2})
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := db.MigrateEmbedded(database); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := database.Exec("TRUNCATE TABLE audit_events, event_deliveries, events, event_subscriptions, compute_cluster_users, compute_clusters, users, organizations CASCADE"); err != nil {
+ t.Fatal(err)
+ }
+ ctx := context.Background()
+ bus, err := events.New(ctx, database)
+ if err != nil {
+ t.Fatal(err)
+ }
+ svc := service.New(database, bus)
+ relay := &syncRelay{}
+ NewNotifier(svc, relay, Site{SiteName: "Example HPC", PortalURL: "https://portal.example.edu", ClusterHost: "login.example.edu", SupportEmail: "help@example.edu"}).RegisterSubscribers(bus, "email-notifier")
+
+ org, err := svc.CreateOrganization(ctx, &models.Organization{OriginatedID: uuid.NewString(), Name: "Example University"})
+ if err != nil {
+ t.Fatal(err)
+ }
+ cluster, err := svc.CreateComputeCluster(ctx, &models.ComputeCluster{Name: "hpc-" + uuid.NewString()[:8]})
+ if err != nil {
+ t.Fatal(err)
+ }
+ newUser := func(first, username string) string {
+ user, err := svc.CreateUser(ctx, &models.User{OrganizationID: org.ID, FirstName: first, LastName: "Doe", Email: username + "@example.edu"})
+ if err != nil {
+ t.Fatal(err)
+ }
+ return user.ID
+ }
+ admin := newUser("Ada", "aadmin")
+ account := func(first, username string, status models.ClusterAccountApproval) *models.ComputeClusterUser {
+ cu := &models.ComputeClusterUser{ComputeClusterID: cluster.ID, UserID: newUser(first, username), LocalUsername: username, ApprovalStatus: status}
+ if status == models.ClusterAccountApproved {
+ cu.ReviewedBy = &admin
+ }
+ cu, err := svc.CreateComputeClusterUser(ctx, cu)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return cu
+ }
+ account("Jane", "jdoe", models.ClusterAccountPending)
+ john := account("John", "johndoe", models.ClusterAccountPending)
+ if _, err := svc.DenyComputeClusterUser(ctx, john.ID, admin, "Not on the allocation."); err != nil {
+ t.Fatal(err)
+ }
+ amy := account("Amy", "amydoe", models.ClusterAccountApproved)
+ if err := svc.MarkComputeClusterUserProvisioned(ctx, amy.ID); err != nil {
+ t.Fatal(err)
+ }
+
+ runCtx, stop := context.WithCancel(ctx)
+ go bus.Run(runCtx)
+ deadline := time.Now().Add(5 * time.Second)
+ for relay.count() < 4 && time.Now().Before(deadline) {
+ time.Sleep(50 * time.Millisecond)
+ }
+ stop()
+
+ want := []string{
+ "amydoe@example.edu | Your Example HPC account is ready",
+ "jdoe@example.edu | We received a request for your Example HPC account",
+ "johndoe@example.edu | We received a request for your Example HPC account",
+ "johndoe@example.edu | Your Example HPC account request was not approved",
+ }
+ slices.Sort(relay.sent)
+ if !slices.Equal(relay.sent, want) {
+ t.Fatalf("emails sent:\n%v\nwant:\n%v", relay.sent, want)
+ }
+ var audited int
+ if err := database.Get(&audited, "SELECT COUNT(*) FROM audit_events WHERE event_type = $1 AND source = 'email-notifier'", AuditNotificationSent); err != nil {
+ t.Fatal(err)
+ }
+ if audited != len(want) {
+ t.Fatalf("expected %d sent-email audit rows, got %d", len(want), audited)
+ }
+}
diff --git a/connectors/Notification/Email/internal/notify/notifier_test.go b/connectors/Notification/Email/internal/notify/notifier_test.go
new file mode 100644
index 000000000..8ede11f3c
--- /dev/null
+++ b/connectors/Notification/Email/internal/notify/notifier_test.go
@@ -0,0 +1,182 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package notify
+
+import (
+ "context"
+ "errors"
+ "strings"
+ "testing"
+
+ "github.com/apache/airavata-custos/pkg/events"
+ "github.com/apache/airavata-custos/pkg/models"
+ "github.com/apache/airavata-custos/pkg/service"
+)
+
+// mockRelay stands in for the SMTP relay and keeps what it was given.
+type mockRelay struct {
+ sent []Message
+ err error
+}
+
+func (r *mockRelay) Send(_ context.Context, m Message) error {
+ if r.err != nil {
+ return r.err
+ }
+ r.sent = append(r.sent, m)
+ return nil
+}
+
+// mockCore is a core holding Jane Doe with an ACCESS allocation on the
+// "hpc" cluster and an unrelated one on another cluster listed first.
+func mockCore(email string) *service.CoreServiceMock {
+ allocations := map[string]*models.ComputeAllocation{
+ "alloc-other": {ID: "alloc-other", ProjectID: "proj-other", ComputeClusterID: "other"},
+ "alloc-hpc": {ID: "alloc-hpc", ProjectID: "proj-hpc", ComputeClusterID: "hpc"},
+ }
+ projects := map[string]*models.Project{
+ "proj-other": {ID: "proj-other", OriginatedID: "OTHER1", Origination: "nairr"},
+ "proj-hpc": {ID: "proj-hpc", OriginatedID: "CIS250123", Origination: "access"},
+ }
+ return &service.CoreServiceMock{
+ GetUserFunc: func(_ context.Context, id string) (*models.User, error) {
+ return &models.User{ID: id, FirstName: "Jane", Email: email}, nil
+ },
+ ListAllocationsForUserFunc: func(context.Context, string) ([]models.ComputeAllocationMembership, error) {
+ return []models.ComputeAllocationMembership{{ComputeAllocationID: "alloc-other"}, {ComputeAllocationID: "alloc-hpc"}}, nil
+ },
+ GetComputeAllocationFunc: func(_ context.Context, id string) (*models.ComputeAllocation, error) {
+ return allocations[id], nil
+ },
+ GetProjectFunc: func(_ context.Context, id string) (*models.Project, error) {
+ return projects[id], nil
+ },
+ CreateAuditEventFunc: func(_ context.Context, e *models.AuditEvent) (*models.AuditEvent, error) {
+ return e, nil
+ },
+ }
+}
+
+func testNotifier(core service.CoreService, relay Sender) *Notifier {
+ n := NewNotifier(core, relay, Site{SiteName: "Example HPC", PortalURL: "https://portal.example.edu", ClusterHost: "login.example.edu", SupportEmail: "help@example.edu"})
+ n.source = "email-notifier"
+ return n
+}
+
+func pendingAccount() models.ComputeClusterUser {
+ return models.ComputeClusterUser{ID: "cu-1", UserID: "u-1", ComputeClusterID: "hpc", LocalUsername: "jdoe", ApprovalStatus: models.ClusterAccountPending}
+}
+
+// Make sure only a pending account gets the request received email. The admin directly added
+// accounts are already approved, and those users get only the ready email.
+func TestRequestReceived_OnlyForPendingAccounts(t *testing.T) {
+ relay := &mockRelay{}
+ n := testNotifier(mockCore("jdoe@example.edu"), relay)
+
+ approved := pendingAccount()
+ approved.ApprovalStatus = models.ClusterAccountApproved
+ if err := n.requestReceived(context.Background(), approved); err != nil {
+ t.Fatal(err)
+ }
+ if len(relay.sent) != 0 {
+ t.Fatalf("an approved account got %d request received emails", len(relay.sent))
+ }
+
+ if err := n.requestReceived(context.Background(), pendingAccount()); err != nil {
+ t.Fatal(err)
+ }
+ if len(relay.sent) != 1 || relay.sent[0].To != "jdoe@example.edu" {
+ t.Fatalf("expected one email to jdoe@example.edu, got %+v", relay.sent)
+ }
+}
+
+// Make sure the email indicates the project of the allocation on the account's cluster.
+func TestRequestReceived_NamesTheProjectOnTheSameCluster(t *testing.T) {
+ relay := &mockRelay{}
+ n := testNotifier(mockCore("jdoe@example.edu"), relay)
+
+ if err := n.requestReceived(context.Background(), pendingAccount()); err != nil {
+ t.Fatal(err)
+ }
+ text := relay.sent[0].Text
+ if !strings.Contains(text, "Requested through: ACCESS") || !strings.Contains(text, "Project: CIS250123") {
+ t.Fatalf("expected the ACCESS project CIS250123, got:\n%s", text)
+ }
+}
+
+// Make sure each email sent records an audit event.
+func TestSend_AuditsEachSentEmail(t *testing.T) {
+ core := mockCore("jdoe@example.edu")
+ n := testNotifier(core, &mockRelay{})
+
+ if err := n.accountReady(context.Background(), pendingAccount()); err != nil {
+ t.Fatal(err)
+ }
+ calls := core.CreateAuditEventCalls()
+ if len(calls) != 1 {
+ t.Fatalf("expected one audit row, got %d", len(calls))
+ }
+ e := calls[0].E
+ if e.EventType != AuditNotificationSent || e.EntityID != "cu-1" || e.Source != "email-notifier" ||
+ e.Details != `{"channel":"email","recipient":"jdoe@example.edu","template":"account-ready"}` {
+ t.Fatalf("unexpected audit row %+v", e)
+ }
+}
+
+// Make sure an email send failure is returned, so the event worker records the failed delivery and retries it.
+func TestSend_RelayFailureIsRetriedAndNotRecordedAsSent(t *testing.T) {
+ core := mockCore("jdoe@example.edu")
+ n := testNotifier(core, &mockRelay{err: errors.New("421 try again later")})
+
+ err := n.accountReady(context.Background(), pendingAccount())
+ if err == nil || errors.Is(err, events.ErrPermanent) {
+ t.Fatalf("expected a retryable error, got %v", err)
+ }
+ if len(core.CreateAuditEventCalls()) != 0 {
+ t.Fatal("a failed send was audited as sent")
+ }
+}
+
+// Make sure a user with no email fails the delivery at once permanently since retrying cannot fix it.
+func TestSend_UserWithoutEmailFailsPermanently(t *testing.T) {
+ relay := &mockRelay{}
+ n := testNotifier(mockCore(""), relay)
+
+ if err := n.accountReady(context.Background(), pendingAccount()); !errors.Is(err, events.ErrPermanent) {
+ t.Fatalf("expected a permanent failure, got %v", err)
+ }
+ if len(relay.sent) != 0 {
+ t.Fatal("an email was sent with no recipient")
+ }
+}
+
+// Make sure the denied email carries the reason the admin gave.
+func TestRequestDenied_CarriesTheReason(t *testing.T) {
+ relay := &mockRelay{}
+ n := testNotifier(mockCore("jdoe@example.edu"), relay)
+ cu := pendingAccount()
+ reason := "We could not confirm your allocation."
+ cu.ApprovalStatus, cu.ReviewNote = models.ClusterAccountDenied, &reason
+
+ if err := n.requestDenied(context.Background(), cu); err != nil {
+ t.Fatal(err)
+ }
+ if !strings.Contains(relay.sent[0].Text, reason) || !strings.Contains(relay.sent[0].HTML, reason) {
+ t.Fatal("the denied email does not carry the reason")
+ }
+}
diff --git a/connectors/Notification/Email/internal/notify/render.go b/connectors/Notification/Email/internal/notify/render.go
new file mode 100644
index 000000000..f618e2149
--- /dev/null
+++ b/connectors/Notification/Email/internal/notify/render.go
@@ -0,0 +1,88 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package notify
+
+import (
+ "bytes"
+ "embed"
+ htmltemplate "html/template"
+ texttemplate "text/template"
+)
+
+// Template names and also used in the audit rows.
+const (
+ RequestReceived = "request-received"
+ AccountReady = "account-ready"
+ RequestDenied = "request-denied"
+)
+
+//go:embed templates/*.tmpl
+var templateFS embed.FS
+
+// Site is the deployment identity every email renders.
+type Site struct {
+ SiteName string
+ PortalURL string
+ ClusterHost string
+ SupportEmail string
+ LogoURL string
+}
+
+// Data fills a template. Empty optional fields drop their lines.
+type Data struct {
+ Site
+ Subject string
+ FirstName string
+ Username string
+ Source string
+ ProjectNumber string
+ Reason string
+}
+
+type emailTemplate struct {
+ text *texttemplate.Template
+ html *htmltemplate.Template
+}
+
+var templates = map[string]emailTemplate{}
+
+func init() {
+ for _, name := range []string{RequestReceived, AccountReady, RequestDenied} {
+ templates[name] = emailTemplate{
+ text: texttemplate.Must(texttemplate.ParseFS(templateFS, "templates/"+name+".txt.tmpl")),
+ html: htmltemplate.Must(htmltemplate.ParseFS(templateFS, "templates/layout.html.tmpl", "templates/"+name+".html.tmpl")),
+ }
+ }
+}
+
+// Render builds the subject and both bodies of the named email.
+func Render(name string, d Data) (Message, error) {
+ t := templates[name]
+ var subject, text, html bytes.Buffer
+ if err := t.text.ExecuteTemplate(&subject, "subject", d); err != nil {
+ return Message{}, err
+ }
+ d.Subject = subject.String()
+ if err := t.text.ExecuteTemplate(&text, "text", d); err != nil {
+ return Message{}, err
+ }
+ if err := t.html.ExecuteTemplate(&html, "layout", d); err != nil {
+ return Message{}, err
+ }
+ return Message{Subject: d.Subject, Text: text.String(), HTML: html.String()}, nil
+}
diff --git a/connectors/Notification/Email/internal/notify/render_test.go b/connectors/Notification/Email/internal/notify/render_test.go
new file mode 100644
index 000000000..32df7a71c
--- /dev/null
+++ b/connectors/Notification/Email/internal/notify/render_test.go
@@ -0,0 +1,50 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package notify
+
+import (
+ "strings"
+ "testing"
+)
+
+// Make sure an account with no project yet, like one an admin adds, renders
+// without empty "Requested through" and "Project" lines.
+func TestRender_LeavesOutMissingProject(t *testing.T) {
+ for _, name := range []string{RequestReceived, RequestDenied} {
+ m, err := Render(name, Data{Site: Site{SiteName: "Example HPC"}, Username: "jdoe", Reason: "No allocation."})
+ if err != nil {
+ t.Fatalf("%s: %v", name, err)
+ }
+ for _, label := range []string{"Requested through", "Project"} {
+ if strings.Contains(m.Text, label) || strings.Contains(m.HTML, label) {
+ t.Errorf("%s shows %q with no project", name, label)
+ }
+ }
+ }
+}
+
+// Make sure the admin's free-text reason cannot inject markup into the email.
+func TestRender_EscapesTheReason(t *testing.T) {
+ m, err := Render(RequestDenied, Data{Site: Site{SiteName: "Example HPC"}, Reason: `<a href="https://example.com">click</a>`})
+ if err != nil {
+ t.Fatal(err)
+ }
+ if strings.Contains(m.HTML, `<a href="https://example.com">`) {
+ t.Fatal("the reason was rendered as markup")
+ }
+}
diff --git a/connectors/Notification/Email/internal/notify/smtp.go b/connectors/Notification/Email/internal/notify/smtp.go
new file mode 100644
index 000000000..cd4501d5c
--- /dev/null
+++ b/connectors/Notification/Email/internal/notify/smtp.go
@@ -0,0 +1,69 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package notify
+
+import (
+ "context"
+
+ "github.com/wneessen/go-mail"
+)
+
+type Message struct {
+ To string
+ Subject string
+ Text string
+ HTML string
+}
+
+type Sender interface {
+ Send(ctx context.Context, m Message) error
+}
+
+// SMTP sends through any relay that accepts authenticated STARTTLS on the configured port.
+type SMTP struct {
+ client *mail.Client
+ from string
+}
+
+func NewSMTP(host string, port int, username, password, from string) (*SMTP, error) {
+ client, err := mail.NewClient(host,
+ mail.WithPort(port),
+ mail.WithSMTPAuth(mail.SMTPAuthPlain),
+ mail.WithUsername(username),
+ mail.WithPassword(password),
+ mail.WithTLSPolicy(mail.TLSMandatory),
+ )
+ if err != nil {
+ return nil, err
+ }
+ return &SMTP{client: client, from: from}, nil
+}
+
+func (s *SMTP) Send(ctx context.Context, m Message) error {
+ msg := mail.NewMsg()
+ if err := msg.From(s.from); err != nil {
+ return err
+ }
+ if err := msg.To(m.To); err != nil {
+ return err
+ }
+ msg.Subject(m.Subject)
+ msg.SetBodyString(mail.TypeTextPlain, m.Text)
+ msg.AddAlternativeString(mail.TypeTextHTML, m.HTML)
+ return s.client.DialAndSendWithContext(ctx, msg)
+}
diff --git a/connectors/Notification/Email/internal/notify/templates/account-ready.html.tmpl b/connectors/Notification/Email/internal/notify/templates/account-ready.html.tmpl
new file mode 100644
index 000000000..39c3b51b6
--- /dev/null
+++ b/connectors/Notification/Email/internal/notify/templates/account-ready.html.tmpl
@@ -0,0 +1,74 @@
+{{/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/}}
+{{define "preheader"}}Your username is {{.Username}}. Sign in to the portal to get started.{{end}}
+{{define "status"}}<td class="pill-ok" style="padding:4px 10px; border:1px solid #86efac; border-radius:999px; background-color:#f0fdf4; color:#15803d; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; font-size:13px; line-height:18px; font-weight:600;">✓ Ready</td>{{end}}
+{{define "footer"}}You are receiving this because an account on {{.SiteName}} was created for you. This is an automated message.{{end}}
+{{define "body"}}
+<h1 class="h1 t-strong" style="margin:0 0 16px 0; font-size:24px; line-height:32px; font-weight:700; color:#111111;">Your account is ready</h1>
+<p class="t-body" style="margin:0 0 16px 0; font-size:16px; line-height:26px; color:#404040;">Hi{{if .FirstName}} {{.FirstName}}{{end}},</p>
+<p class="t-body" style="margin:0 0 16px 0; font-size:16px; line-height:26px; color:#404040;">Your {{.SiteName}} account is ready. Sign in to the portal first, then you can connect to the cluster.</p>
+<p class="t-muted" style="margin:24px 0 8px 0; font-size:13px; line-height:18px; font-weight:600; letter-spacing:0.04em; text-transform:uppercase; color:#4b5563;">Your account</p>
+{{/* The plain anchors stop mail apps turning the host into a link, and keep a copied ssh command clean. */}}
+<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" class="bg-code" style="margin:0 0 16px 0; background-color:#f4f5f7; border:1px solid #e5e7eb; border-radius:8px; border-collapse:separate;">
+<tr>
+<td class="t-muted" style="padding:12px 16px 2px 16px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; font-size:13px; line-height:18px; color:#4b5563;">Username</td>
+</tr>
+<tr>
+<td class="t-strong" style="padding:0 16px 12px 16px; font-family:ui-monospace,SFMono-Regular,'SF Mono',Menlo,Consolas,'Liberation Mono',monospace; font-size:16px; line-height:24px; font-weight:600; color:#111111; word-break:break-all;"><a href="#" style="color:inherit; text-decoration:none; cursor:text;">{{.Username}}</a></td>
+</tr>
+<tr>
+<td class="t-muted" style="padding:12px 16px 2px 16px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; font-size:13px; line-height:18px; color:#4b5563;">Login host</td>
+</tr>
+<tr>
+<td class="t-strong" style="padding:0 16px 12px 16px; font-family:ui-monospace,SFMono-Regular,'SF Mono',Menlo,Consolas,'Liberation Mono',monospace; font-size:16px; line-height:24px; font-weight:600; color:#111111; word-break:break-all;"><a href="#" style="color:inherit; text-decoration:none; cursor:text;">{{.ClusterHost}}</a></td>
+</tr>
+<tr>
+<td class="t-muted" style="padding:12px 16px 2px 16px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; font-size:13px; line-height:18px; color:#4b5563;">Connect with SSH</td>
+</tr>
+<tr>
+<td class="t-strong" style="padding:0 16px 12px 16px; font-family:ui-monospace,SFMono-Regular,'SF Mono',Menlo,Consolas,'Liberation Mono',monospace; font-size:16px; line-height:24px; font-weight:600; color:#111111; word-break:break-all;"><a href="#" style="color:inherit; text-decoration:none; cursor:text;">ssh {{.Username}}@{{.ClusterHost}}</a></td>
+</tr>
+</table>
+<p class="t-muted" style="margin:24px 0 8px 0; font-size:13px; line-height:18px; font-weight:600; letter-spacing:0.04em; text-transform:uppercase; color:#4b5563;">What to do first</p>
+<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="margin:0 0 12px 0;">
+<tr>
+<td width="32" valign="top" class="t-strong" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; padding-top:2px; font-size:15px; line-height:22px; font-weight:700; color:#111111;">1.</td>
+<td valign="top" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;">
+<p class="t-strong" style="margin:0 0 2px 0; font-size:16px; line-height:24px; font-weight:600; color:#111111;">Sign in to the portal first</p>
+<p class="t-body" style="margin:0; font-size:16px; line-height:24px; color:#404040;">Use your institution's login. This activates your cluster login, so do it before connecting.</p>
+</td>
+</tr>
+</table>
+<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="margin:0 0 12px 0;">
+<tr>
+<td width="32" valign="top" class="t-strong" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; padding-top:2px; font-size:15px; line-height:22px; font-weight:700; color:#111111;">2.</td>
+<td valign="top" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;">
+<p class="t-strong" style="margin:0 0 2px 0; font-size:16px; line-height:24px; font-weight:600; color:#111111;">Connect to the cluster</p>
+<p class="t-body" style="margin:0; font-size:16px; line-height:24px; color:#404040;">Open a terminal and run the SSH command above. When asked, finish signing in with your institution's login.</p>
+</td>
+</tr>
+</table>
+<table role="presentation" cellpadding="0" cellspacing="0" border="0" style="margin:8px 0 16px 0;">
+<tr>
+<td class="btn-td" align="center" bgcolor="#171717" style="border-radius:8px; background-color:#171717; mso-padding-alt:14px 28px;">
+<a class="btn-a" href="{{.PortalURL}}" style="display:inline-block; padding:14px 28px; min-height:20px; border:1px solid #171717; border-radius:8px; background-color:#171717; color:#ffffff; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; font-size:16px; line-height:20px; font-weight:600; text-decoration:none;">Sign in to {{.SiteName}}</a>
+</td>
+</tr>
+</table>
+{{end}}
diff --git a/connectors/Notification/Email/internal/notify/templates/account-ready.txt.tmpl b/connectors/Notification/Email/internal/notify/templates/account-ready.txt.tmpl
new file mode 100644
index 000000000..4621b28f3
--- /dev/null
+++ b/connectors/Notification/Email/internal/notify/templates/account-ready.txt.tmpl
@@ -0,0 +1,41 @@
+{{/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/}}
+{{define "subject"}}Your {{.SiteName}} account is ready{{end}}
+{{define "text"}}Hi{{if .FirstName}} {{.FirstName}}{{end}},
+
+Your {{.SiteName}} account is ready. Sign in to the portal first, then
+you can connect to the cluster.
+
+Username: {{.Username}}
+Login host: {{.ClusterHost}}
+Connect with SSH: ssh {{.Username}}@{{.ClusterHost}}
+
+What to do first
+1. Sign in to the portal first, with your institution's login. This
+ activates your cluster login, so do it before connecting:
+ {{.PortalURL}}
+2. Open a terminal and run the SSH command above. When asked, finish
+ signing in with your institution's login.
+
+Questions? Write to {{.SupportEmail}}.
+
+--
+You are receiving this because an account on {{.SiteName}} was created
+for you. This is an automated message.
+{{end}}
diff --git a/connectors/Notification/Email/internal/notify/templates/layout.html.tmpl b/connectors/Notification/Email/internal/notify/templates/layout.html.tmpl
new file mode 100644
index 000000000..67883ee31
--- /dev/null
+++ b/connectors/Notification/Email/internal/notify/templates/layout.html.tmpl
@@ -0,0 +1,116 @@
+{{/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/}}
+{{/* Shared shell. Each email defines preheader, status, body, and footer. */}}
+{{define "layout"}}<!doctype html>
+<html lang="en" dir="ltr">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<meta http-equiv="X-UA-Compatible" content="IE=edge">
+<meta name="x-apple-disable-message-reformatting">
+<meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no">
+<meta name="color-scheme" content="light dark">
+<meta name="supported-color-schemes" content="light dark">
+<title>{{.Subject}}</title>
+<style>
+ :root { color-scheme: light dark; supported-color-schemes: light dark; }
+ body { margin:0 !important; padding:0 !important; width:100% !important; }
+ a[x-apple-data-detectors] { color:inherit !important; text-decoration:none !important; font-size:inherit !important; font-family:inherit !important; font-weight:inherit !important; line-height:inherit !important; }
+ u + #body a { color:inherit; text-decoration:none; font-size:inherit; font-family:inherit; font-weight:inherit; line-height:inherit; }
+ .link { color:#b35f00 !important; text-decoration:underline !important; }
+ @media (max-width:620px) {
+ .card-pad { padding-left:20px !important; padding-right:20px !important; }
+ .outer-pad { padding:16px 8px !important; }
+ .h1 { font-size:22px !important; }
+ }
+ @media (prefers-color-scheme: dark) {
+ .bg-page { background-color:#111111 !important; }
+ .bg-card { background-color:#262626 !important; border-color:#404040 !important; }
+ .bg-foot { background-color:#1c1c1c !important; border-color:#404040 !important; }
+ .bg-code { background-color:#111111 !important; border-color:#404040 !important; }
+ .rule { border-color:#404040 !important; }
+ .t-strong { color:#f4f5f7 !important; }
+ .t-body { color:#d4d4d4 !important; }
+ .t-muted { color:#9aa1ae !important; }
+ .link { color:#ffa726 !important; }
+ .btn-td { background-color:#ffa726 !important; }
+ .btn-a { background-color:#ffa726 !important; border-color:#ffa726 !important; color:#111111 !important; }
+ .pill-info { background-color:#1e3a5f !important; color:#d2e1f1 !important; border-color:#4d86c9 !important; }
+ .pill-ok { background-color:#14381f !important; color:#bbf7d0 !important; border-color:#16a34a !important; }
+ .pill-err { background-color:#4a1717 !important; color:#fecaca !important; border-color:#dc2626 !important; }
+ .quote { border-color:#6b7280 !important; }
+ }
+ [data-ogsb] .bg-page { background-color:#111111 !important; }
+ [data-ogsb] .bg-card { background-color:#262626 !important; }
+ [data-ogsb] .bg-foot { background-color:#1c1c1c !important; }
+ [data-ogsb] .bg-code { background-color:#111111 !important; }
+ [data-ogsc] .t-strong { color:#f4f5f7 !important; }
+ [data-ogsc] .t-body { color:#d4d4d4 !important; }
+ [data-ogsc] .t-muted { color:#9aa1ae !important; }
+ [data-ogsc] .link { color:#ffa726 !important; }
+ [data-ogsb] .btn-td, [data-ogsb] .btn-a { background-color:#ffa726 !important; }
+ [data-ogsc] .btn-a { color:#111111 !important; }
+</style>
+</head>
+<body id="body" class="bg-page" style="margin:0; padding:0; width:100%; background-color:#f4f5f7; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;">
+{{/* The filler stops the body text showing up in the inbox preview. */}}
+<div style="display:none; max-height:0; max-width:0; overflow:hidden; opacity:0; mso-hide:all; font-size:1px; line-height:1px; color:#f4f5f7;">{{template "preheader" .}} ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏</div>
+<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" class="bg-page" style="background-color:#f4f5f7;">
+<tr>
+<td align="center" class="outer-pad" style="padding:32px 16px;">
+<table role="presentation" width="600" cellpadding="0" cellspacing="0" border="0" class="bg-card" style="width:100%; max-width:600px; background-color:#ffffff; border:1px solid #e5e7eb; border-radius:12px; border-collapse:separate;">
+<tr><td height="4" style="height:4px; line-height:4px; font-size:4px; background-color:#fe8c00; border-radius:12px 12px 0 0;"> </td></tr>
+{{/* The site name is text so the header still reads when images are off. */}}
+<tr>
+<td class="card-pad" style="padding:24px 32px 0 32px;">
+<table role="presentation" cellpadding="0" cellspacing="0" border="0">
+<tr>
+{{if .LogoURL}}<td width="28" valign="middle" style="padding-right:10px;"><img src="{{.LogoURL}}" width="28" height="28" alt="" style="display:block; width:28px; height:28px; border:0; outline:none;"></td>{{end}}
+<td valign="middle" class="t-strong" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; font-size:17px; line-height:24px; font-weight:700; color:#111111;">{{.SiteName}}</td>
+</tr>
+</table>
+</td>
+</tr>
+<tr>
+<td class="card-pad" style="padding:28px 32px 0 32px;">
+<table role="presentation" cellpadding="0" cellspacing="0" border="0">
+<tr>
+{{template "status" .}}
+</tr>
+</table>
+</td>
+</tr>
+<tr>
+<td class="card-pad" style="padding:16px 32px 8px 32px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;">
+{{template "body" .}}
+</td>
+</tr>
+<tr>
+<td class="card-pad bg-foot rule" style="padding:20px 32px; background-color:#f9fafb; border-top:1px solid #e5e7eb; border-radius:0 0 12px 12px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;">
+<p class="t-muted" style="margin:0 0 8px 0; font-size:13px; line-height:20px; color:#4b5563;">{{template "footer" .}}</p>
+<p class="t-muted" style="margin:0; font-size:13px; line-height:20px; color:#4b5563;">Questions? Write to <a class="link" href="mailto:{{.SupportEmail}}" style="color:#b35f00; text-decoration:underline;">{{.SupportEmail}}</a>.</p>
+</td>
+</tr>
+</table>
+</td>
+</tr>
+</table>
+</body>
+</html>
+{{end}}
diff --git a/connectors/Notification/Email/internal/notify/templates/request-denied.html.tmpl b/connectors/Notification/Email/internal/notify/templates/request-denied.html.tmpl
new file mode 100644
index 000000000..de4bca651
--- /dev/null
+++ b/connectors/Notification/Email/internal/notify/templates/request-denied.html.tmpl
@@ -0,0 +1,53 @@
+{{/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/}}
+{{define "preheader"}}See the administrator's reason and who to contact.{{end}}
+{{define "status"}}<td class="pill-err" style="padding:4px 10px; border:1px solid #fca5a5; border-radius:999px; background-color:#fef2f2; color:#b91c1c; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; font-size:13px; line-height:18px; font-weight:600;">✕ Not approved</td>{{end}}
+{{define "footer"}}You are receiving this because an account on {{.SiteName}} was requested for you. This is an automated message.{{end}}
+{{define "body"}}
+<h1 class="h1 t-strong" style="margin:0 0 16px 0; font-size:24px; line-height:32px; font-weight:700; color:#111111;">Your request was not approved</h1>
+<p class="t-body" style="margin:0 0 16px 0; font-size:16px; line-height:26px; color:#404040;">Hi{{if .FirstName}} {{.FirstName}}{{end}},</p>
+<p class="t-body" style="margin:0 0 16px 0; font-size:16px; line-height:26px; color:#404040;">Your request for an account on {{.SiteName}} was not approved, and no account was created.</p>
+<p class="t-muted" style="margin:24px 0 8px 0; font-size:13px; line-height:18px; font-weight:600; letter-spacing:0.04em; text-transform:uppercase; color:#4b5563;">Reason from the administrator</p>
+<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="margin:0 0 16px 0;">
+<tr>
+<td class="quote t-body" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; padding:4px 0 4px 16px; border-left:3px solid #9aa1ae; font-size:16px; line-height:26px; color:#404040; white-space:pre-line;">{{.Reason}}</td>
+</tr>
+</table>
+{{if or .Source .ProjectNumber}}
+<p class="t-muted" style="margin:24px 0 8px 0; font-size:13px; line-height:18px; font-weight:600; letter-spacing:0.04em; text-transform:uppercase; color:#4b5563;">Request details</p>
+<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="margin:0 0 16px 0;">
+{{if .Source}}<tr>
+<td class="t-muted rule" width="40%" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; padding:10px 0; border-top:1px solid #e5e7eb; font-size:14px; line-height:20px; color:#4b5563; vertical-align:top;">Requested through</td>
+<td class="t-strong rule" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; padding:10px 0; border-top:1px solid #e5e7eb; font-size:15px; line-height:20px; font-weight:600; color:#111111; vertical-align:top;">{{.Source}}</td>
+</tr>{{end}}
+{{if .ProjectNumber}}<tr>
+<td class="t-muted rule" width="40%" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; padding:10px 0; border-top:1px solid #e5e7eb; font-size:14px; line-height:20px; color:#4b5563; vertical-align:top;">Project</td>
+<td class="t-strong rule" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; padding:10px 0; border-top:1px solid #e5e7eb; font-size:15px; line-height:20px; font-weight:600; color:#111111; vertical-align:top;">{{.ProjectNumber}}</td>
+</tr>{{end}}
+</table>
+{{end}}
+<p class="t-body" style="margin:0 0 16px 0; font-size:16px; line-height:26px; color:#404040;">If you have questions or think this was a mistake, contact us.</p>
+<table role="presentation" cellpadding="0" cellspacing="0" border="0" style="margin:8px 0 16px 0;">
+<tr>
+<td class="btn-td" align="center" bgcolor="#171717" style="border-radius:8px; background-color:#171717; mso-padding-alt:14px 28px;">
+<a class="btn-a" href="mailto:{{.SupportEmail}}?subject=Account%20request" style="display:inline-block; padding:14px 28px; min-height:20px; border:1px solid #171717; border-radius:8px; background-color:#171717; color:#ffffff; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; font-size:16px; line-height:20px; font-weight:600; text-decoration:none;">Contact support</a>
+</td>
+</tr>
+</table>
+{{end}}
diff --git a/connectors/Notification/Email/internal/notify/templates/request-denied.txt.tmpl b/connectors/Notification/Email/internal/notify/templates/request-denied.txt.tmpl
new file mode 100644
index 000000000..8032e5949
--- /dev/null
+++ b/connectors/Notification/Email/internal/notify/templates/request-denied.txt.tmpl
@@ -0,0 +1,38 @@
+{{/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/}}
+{{define "subject"}}Your {{.SiteName}} account request was not approved{{end}}
+{{define "text"}}Hi{{if .FirstName}} {{.FirstName}}{{end}},
+
+Your request for an account on {{.SiteName}} was not approved, and no
+account was created.
+
+Reason from the administrator:
+{{.Reason}}
+{{if or .Source .ProjectNumber}}
+Request details
+{{if .Source}}Requested through: {{.Source}}
+{{end}}{{if .ProjectNumber}}Project: {{.ProjectNumber}}
+{{end}}{{end}}
+If you have questions or think this was a mistake, write to
+{{.SupportEmail}}.
+
+--
+You are receiving this because an account on {{.SiteName}} was requested
+for you. This is an automated message.
+{{end}}
diff --git a/connectors/Notification/Email/internal/notify/templates/request-received.html.tmpl b/connectors/Notification/Email/internal/notify/templates/request-received.html.tmpl
new file mode 100644
index 000000000..3038b3550
--- /dev/null
+++ b/connectors/Notification/Email/internal/notify/templates/request-received.html.tmpl
@@ -0,0 +1,42 @@
+{{/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/}}
+{{define "preheader"}}An administrator is reviewing it. We will email you when your account is ready.{{end}}
+{{define "status"}}<td class="pill-info" style="padding:4px 10px; border:1px solid #a6c3e4; border-radius:999px; background-color:#e9f0f8; color:#153b6e; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; font-size:13px; line-height:18px; font-weight:600;">● Under review</td>{{end}}
+{{define "footer"}}You are receiving this because an account on {{.SiteName}} was requested for you{{if .Source}} through {{.Source}}{{end}}. This is an automated message.{{end}}
+{{define "body"}}
+<h1 class="h1 t-strong" style="margin:0 0 16px 0; font-size:24px; line-height:32px; font-weight:700; color:#111111;">We received a request for your account</h1>
+<p class="t-body" style="margin:0 0 16px 0; font-size:16px; line-height:26px; color:#404040;">Hi{{if .FirstName}} {{.FirstName}}{{end}},</p>
+<p class="t-body" style="margin:0 0 16px 0; font-size:16px; line-height:26px; color:#404040;">We received a request to create an account for you on {{.SiteName}}. An administrator is reviewing it, and we will email you again when your account is ready.</p>
+<p class="t-muted" style="margin:24px 0 8px 0; font-size:13px; line-height:18px; font-weight:600; letter-spacing:0.04em; text-transform:uppercase; color:#4b5563;">Request details</p>
+<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="margin:0 0 16px 0;">
+{{if .Source}}<tr>
+<td class="t-muted rule" width="40%" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; padding:10px 0; border-top:1px solid #e5e7eb; font-size:14px; line-height:20px; color:#4b5563; vertical-align:top;">Requested through</td>
+<td class="t-strong rule" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; padding:10px 0; border-top:1px solid #e5e7eb; font-size:15px; line-height:20px; font-weight:600; color:#111111; vertical-align:top;">{{.Source}}</td>
+</tr>{{end}}
+{{if .ProjectNumber}}<tr>
+<td class="t-muted rule" width="40%" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; padding:10px 0; border-top:1px solid #e5e7eb; font-size:14px; line-height:20px; color:#4b5563; vertical-align:top;">Project</td>
+<td class="t-strong rule" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; padding:10px 0; border-top:1px solid #e5e7eb; font-size:15px; line-height:20px; font-weight:600; color:#111111; vertical-align:top;">{{.ProjectNumber}}</td>
+</tr>{{end}}
+<tr>
+<td class="t-muted rule" width="40%" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; padding:10px 0; border-top:1px solid #e5e7eb; font-size:14px; line-height:20px; color:#4b5563; vertical-align:top;">Proposed username</td>
+<td class="t-strong rule" style="font-family:ui-monospace,SFMono-Regular,'SF Mono',Menlo,Consolas,'Liberation Mono',monospace; padding:10px 0; border-top:1px solid #e5e7eb; font-size:15px; line-height:20px; font-weight:600; color:#111111; vertical-align:top;">{{.Username}}</td>
+</tr>
+</table>
+<p class="t-body" style="margin:0 0 16px 0; font-size:16px; line-height:26px; color:#404040;">You don't need to do anything right now.</p>
+{{end}}
diff --git a/connectors/Notification/Email/internal/notify/templates/request-received.txt.tmpl b/connectors/Notification/Email/internal/notify/templates/request-received.txt.tmpl
new file mode 100644
index 000000000..27ac19fff
--- /dev/null
+++ b/connectors/Notification/Email/internal/notify/templates/request-received.txt.tmpl
@@ -0,0 +1,38 @@
+{{/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/}}
+{{define "subject"}}We received a request for your {{.SiteName}} account{{end}}
+{{define "text"}}Hi{{if .FirstName}} {{.FirstName}}{{end}},
+
+We received a request to create an account for you on {{.SiteName}}.
+An administrator is reviewing it, and we will email you again when your
+account is ready.
+
+Request details
+{{if .Source}}Requested through: {{.Source}}
+{{end}}{{if .ProjectNumber}}Project: {{.ProjectNumber}}
+{{end}}Proposed username: {{.Username}}
+
+You don't need to do anything right now.
+
+Questions? Write to {{.SupportEmail}}.
+
+--
+You are receiving this because an account on {{.SiteName}} was requested
+for you{{if .Source}} through {{.Source}}{{end}}. This is an automated message.
+{{end}}
diff --git a/connectors/Notification/Email/pkg/email/loader.go b/connectors/Notification/Email/pkg/email/loader.go
new file mode 100644
index 000000000..ea8e12147
--- /dev/null
+++ b/connectors/Notification/Email/pkg/email/loader.go
@@ -0,0 +1,83 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Package email is the email notification connector entry point. Wired from
+// internal/connectors/loader.go.
+package email
+
+import (
+ "context"
+ "log/slog"
+ "strings"
+ "sync"
+
+ "github.com/jmoiron/sqlx"
+
+ "github.com/apache/airavata-custos/connectors/Notification/Email/internal/notify"
+ "github.com/apache/airavata-custos/internal/config"
+ "github.com/apache/airavata-custos/pkg/events"
+ "github.com/apache/airavata-custos/pkg/identity"
+ "github.com/apache/airavata-custos/pkg/service"
+)
+
+// Type is the connector type in the config file and the subscriber name on the bus.
+const Type = "email-notifier"
+
+// LoadConnector registers the email subscribers.
+func LoadConnector(_ context.Context, _ *sqlx.DB, eventBus *events.Bus, coreService *service.Service, _ *sync.WaitGroup, _ *identity.Router, cfg *config.ConnectorConfig) error {
+ get := func(key string) string {
+ v, _ := cfg.GetStringField(key)
+ // A "${...}" left in place is an env var that was not set.
+ if strings.HasPrefix(v, "${") {
+ return ""
+ }
+ return v
+ }
+ port, err := cfg.GetIntField("smtp_port")
+ if err != nil {
+ port = 587
+ }
+ host, username, password, from := get("smtp_host"), get("username"), get("password"), get("from")
+ site := notify.Site{
+ SiteName: get("site_name"),
+ PortalURL: get("portal_url"),
+ ClusterHost: get("cluster_host"),
+ SupportEmail: get("support_email"),
+ LogoURL: get("logo_url"),
+ }
+ for key, v := range map[string]string{
+ "smtp_host": host, "username": username, "password": password, "from": from,
+ "site_name": site.SiteName, "portal_url": site.PortalURL, "cluster_host": site.ClusterHost, "support_email": site.SupportEmail,
+ } {
+ if v == "" {
+ slog.Info("email notifications: required setting not set; skipping", "setting", key)
+ return nil
+ }
+ }
+
+ if site.LogoURL == "" {
+ site.LogoURL = strings.TrimSuffix(site.PortalURL, "/") + "/brand/logo/custos-mark.png"
+ }
+
+ sender, err := notify.NewSMTP(host, port, username, password, from)
+ if err != nil {
+ return err
+ }
+ notify.NewNotifier(coreService, sender, site).RegisterSubscribers(eventBus, Type)
+ slog.Info("email notifications: subscribers registered", "smtp_host", host, "from", from)
+ return nil
+}
diff --git a/go.mod b/go.mod
index af4f30670..89529b0ec 100644
--- a/go.mod
+++ b/go.mod
@@ -11,6 +11,7 @@ require (
github.com/prometheus/client_golang v1.23.2
github.com/prometheus/client_model v0.6.2
github.com/stretchr/testify v1.11.1
+ github.com/wneessen/go-mail v0.8.1
go.opentelemetry.io/otel v1.45.0
go.opentelemetry.io/otel/sdk v1.45.0
go.opentelemetry.io/otel/trace v1.45.0
@@ -49,12 +50,13 @@ require (
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/otel/metric v1.45.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
- golang.org/x/mod v0.29.0 // indirect
+ golang.org/x/crypto v0.54.0 // indirect
+ golang.org/x/mod v0.37.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
- golang.org/x/sync v0.18.0 // indirect
+ golang.org/x/sync v0.22.0 // indirect
golang.org/x/sys v0.47.0 // indirect
- golang.org/x/text v0.31.0 // indirect
- golang.org/x/tools v0.38.0 // indirect
+ golang.org/x/text v0.40.0 // indirect
+ golang.org/x/tools v0.47.0 // indirect
google.golang.org/protobuf v1.36.8 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
diff --git a/go.sum b/go.sum
index 34e6b6f6b..010778221 100644
--- a/go.sum
+++ b/go.sum
@@ -143,6 +143,8 @@ github.com/swaggo/swag v1.16.6 h1:qBNcx53ZaX+M5dxVyTrgQ0PJ/ACK+NzhwcbieTt+9yI=
github.com/swaggo/swag v1.16.6/go.mod h1:ngP2etMK5a0P3QBizic5MEwpRmluJZPHjXcMoj4Xesg=
github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
+github.com/wneessen/go-mail v0.8.1 h1:tVcncj02/QySVFw3zr/kXOzZcuFQqBNT6K+Rbgm/pcM=
+github.com/wneessen/go-mail v0.8.1/go.mod h1:dWZ61zadzCIyvB4y1/YzC5O7MrbbzBfPkARmbosdf8w=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus=
@@ -161,13 +163,15 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
-golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
-golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
+golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw=
+golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk=
+golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ=
+golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0=
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
-golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
-golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
+golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
+golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
@@ -175,11 +179,11 @@ golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
-golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
-golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
+golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs=
+golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
-golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
+golang.org/x/tools v0.47.0 h1:7Kn5x/d1svx/PzryTsqeoZN4TZwqeH5pGWjefhLi/1Q=
+golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA=
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
diff --git a/internal/connectors/loader.go b/internal/connectors/loader.go
index 7e5cf1869..9d41cb6ca 100644
--- a/internal/connectors/loader.go
+++ b/internal/connectors/loader.go
@@ -25,6 +25,7 @@ import (
"github.com/apache/airavata-custos/connectors/ACCESS/AMIE-Processor/pkg/amie"
"github.com/apache/airavata-custos/connectors/Analytics/pkg/analytics"
"github.com/apache/airavata-custos/connectors/COmanage/Identity-Provisioner/pkg/comanage"
+ "github.com/apache/airavata-custos/connectors/Notification/Email/pkg/email"
"github.com/apache/airavata-custos/connectors/SLURM/Association-Mapper/pkg/smapper"
"github.com/apache/airavata-custos/connectors/SLURM/Usage-Monitor/pkg/monitor"
"github.com/apache/airavata-custos/connectors/Storage/VAST-Provisioner/pkg/vast"
@@ -47,6 +48,7 @@ func LoadConnectorsFromConfig(ctx context.Context, cfg *config.Config, database
tempaccount.Type: tempaccount.LoadConnector,
analytics.Type: analytics.LoadConnector,
vast.Type: vast.LoadConnector,
+ email.Type: email.LoadConnector,
}
for connectorName, connectorCfg := range cfg.Connectors {
diff --git a/web/public/brand/logo/custos-mark.png b/web/public/brand/logo/custos-mark.png
new file mode 100644
index 000000000..9912ad92b
Binary files /dev/null and b/web/public/brand/logo/custos-mark.png differ