mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
refactor: Update SMTPPort type to int in NotificationChannelV2 model
This commit is contained in:
@@ -8,7 +8,7 @@ type NotificationChannelV2 struct {
|
||||
Description string `json:"description" bson:"description"`
|
||||
Provider string `json:"provider" bson:"provider"`
|
||||
SMTPServer string `json:"smtp_server" bson:"smtp_server"`
|
||||
SMTPPort string `json:"smtp_port" bson:"smtp_port"`
|
||||
SMTPPort int `json:"smtp_port" bson:"smtp_port"`
|
||||
SMTPUsername string `json:"smtp_username" bson:"smtp_username"`
|
||||
SMTPPassword string `json:"smtp_password" bson:"smtp_password"`
|
||||
WebhookUrl string `json:"webhook_url" bson:"webhook_url"`
|
||||
|
||||
@@ -10,21 +10,14 @@ import (
|
||||
"net/mail"
|
||||
"regexp"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func SendMail(s *models.NotificationSettingV2, ch *models.NotificationChannelV2, to, cc, bcc, title, content string) error {
|
||||
// config
|
||||
port, err := strconv.Atoi(ch.SMTPPort)
|
||||
if err != nil {
|
||||
log.Errorf("failed to convert SMTP port to int: %v", err)
|
||||
trace.PrintError(err)
|
||||
return err
|
||||
}
|
||||
smtpConfig := smtpAuthentication{
|
||||
Server: ch.SMTPServer,
|
||||
Port: port,
|
||||
Port: ch.SMTPPort,
|
||||
SenderIdentity: s.SenderName,
|
||||
SenderEmail: s.SenderEmail,
|
||||
SMTPUser: ch.SMTPUsername,
|
||||
|
||||
Reference in New Issue
Block a user