123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package main
- import (
- "strconv"
- "time"
- notification "imuslab.com/arozos/mod/notification"
- "imuslab.com/arozos/mod/notification/agents/smtpn"
- )
- var notificationQueue *notification.NotificationQueue
- func notificationInit() {
- //Create a new notification agent
- notificationQueue = notification.NewNotificationQueue()
- //Register the notification agents
- //SMTP Mail Sender
- smtpAgent := smtpn.Agent{
- Hostname: *host_name,
- SMTPSender: "[email protected]",
- SMTPPassword: "",
- SMTPDomain: "mail.gandi.net",
- SMTPPort: 587,
- UsernameToEmailMap: map[string]string{},
- }
- notificationQueue.RegisterNotificationAgent(smtpAgent)
- go func() {
- time.Sleep(10 * time.Second)
- notificationQueue.BroadcastNotification(¬ification.NotificationPayload{
- ID: strconv.Itoa(int(time.Now().Unix())),
- Title: "Disk SMART Error",
- Message: "This is a testing notification for showcasing a sample email when DISK SMART error was scanned and discovered.<br> Please visit <a href='https://blog.teacat.io'>here</a> for more information.",
- Receiver: []string{"TC", "jk", "ay"},
- Sender: "SMART Nightly Scanner",
- ReciverAgents: []string{"smtpn"},
- })
- }()
- }
|