Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Erhan Hayret
BulkMail
Commits
ac21230e
Commit
ac21230e
authored
May 25, 2022
by
Erhan
Browse files
[chore]
parent
625e8b1d
Pipeline
#3
failed with stages
in 0 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/GOProjects/Data/Models/Mail.go
View file @
ac21230e
...
@@ -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"`
...
...
src/GOProjects/Utils/MailSender/MailSender.go
0 → 100644
View file @
ac21230e
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
src/GOProjects/Utils/RabbitMQ/Connection.go
View file @
ac21230e
...
@@ -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
(
"
Send
ed this data => "
,
body
)
//Logger
myLog
.
PrintData
(
"
Queu
ed this data => "
,
body
)
//Logger
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment