Commit ac21230e authored by Erhan's avatar Erhan
Browse files

[chore]

parent 625e8b1d
Pipeline #3 failed with stages
in 0 seconds
...@@ -5,8 +5,7 @@ import( ...@@ -5,8 +5,7 @@ import(
) )
type Mail struct { type Mail struct {
Id primitive.ObjectID `json:"id,omitempty" bson:"_id"` Id primitive.ObjectID `json:"id,omitempty" bson:"_id"`
MailSubject string `json:"mailSubject" bson:"mail_subject"`
MailText string `json:"mailText" bson:"mail_test"` MailText string `json:"mailText" bson:"mail_test"`
SenderEmail string `json:"senderEmail" bson:"sender_email"` SenderEmail string `json:"senderEmail" bson:"sender_email"`
SenderEmailPsw string `json:"senderEmailPsw" bson:"sender_email_psw"` SenderEmailPsw string `json:"senderEmailPsw" bson:"sender_email_psw"`
......
package MailSender
import(
//Local Packages
"net/smtp"
//This Project Packages
"bulkmail/packages/Data/Models"
"bulkmail/packages/Utils/Logger"
)
var smtpHost = "smtp.gmail.com"
var smtpPort = "587"
func Send(mail Models.Mail){
auth := smtp.PalinAuth("", mail.SenderEmail, mail.SenderEmailPsw, smtpHost)
count := len(mail.ArriveEmails)
for var i = 0 ; count > 0 ; i++ {
err := smtp.SendMail(smtpHost + ":" + smtpPort, auth, mail.SenderEmail, mail.ArriveEmails[i], mail.MailText)
if err != nil {
Logger.FailOnError(err, "Mail Can't Send")
return
}
Logger.Print("Mail Sended")
}
}
\ No newline at end of file
...@@ -38,5 +38,5 @@ func AddToQueue(body []byte){ ...@@ -38,5 +38,5 @@ func AddToQueue(body []byte){
Body: body, Body: body,
}) })
myLog.FailOnError(er, "Failed to publish a message") myLog.FailOnError(er, "Failed to publish a message")
myLog.PrintData("Sended this data => ", body)//Logger myLog.PrintData("Queued this data => ", body)//Logger
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment