35 lines
755 B
Go
35 lines
755 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
|
|
"backea/internal/mail"
|
|
|
|
"github.com/joho/godotenv"
|
|
)
|
|
|
|
func main() {
|
|
if err := godotenv.Load(); err != nil {
|
|
log.Println("Warning: No .env file found")
|
|
}
|
|
|
|
client := mail.NewClient()
|
|
|
|
// Check if required environment variables are set
|
|
if client.Config.Host == "" || client.Config.Username == "" || client.Config.Password == "" {
|
|
log.Fatal("Missing required SMTP configuration")
|
|
}
|
|
|
|
// Send notification
|
|
recipients := []string{"romaric.sirii@gmail.com"}
|
|
subject := "Backup Notification"
|
|
body := "Your backup has completed successfully!"
|
|
|
|
if err := client.SendMail(recipients, subject, body); err != nil {
|
|
log.Fatalf("Failed to send email: %v", err)
|
|
}
|
|
|
|
fmt.Println("Notification sent successfully")
|
|
}
|