Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GO Email Worker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stephan Handuwala
GO Email Worker
Commits
eb9fa6ed
Commit
eb9fa6ed
authored
Mar 22, 2019
by
Pasan Mallawaarachchi
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
context added to MG send function
parent
9079da3f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
worker.go
worker.go
+7
-2
No files found.
worker.go
View file @
eb9fa6ed
...
@@ -9,6 +9,7 @@ package main
...
@@ -9,6 +9,7 @@ package main
* - ./<file_name>
* - ./<file_name>
*/
*/
import
(
import
(
"context"
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"io/ioutil"
"io/ioutil"
...
@@ -318,7 +319,9 @@ func worker(i int) {
...
@@ -318,7 +319,9 @@ func worker(i int) {
if
len
(
cc
)
>
0
{
if
len
(
cc
)
>
0
{
message
.
AddCC
(
cc
)
message
.
AddCC
(
cc
)
}
}
MailgunResp
,
id
,
err
:=
mg
.
Send
(
message
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
time
.
Second
*
30
)
defer
cancel
()
MailgunResp
,
id
,
err
:=
mg
.
Send
(
ctx
,
message
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
//alertAdmin(" MAilgun Error \n" + err.Error())
//alertAdmin(" MAilgun Error \n" + err.Error())
...
@@ -367,7 +370,9 @@ func sendMessage(mg mailgun.Mailgun, sender, subject, body, recipient, cc string
...
@@ -367,7 +370,9 @@ func sendMessage(mg mailgun.Mailgun, sender, subject, body, recipient, cc string
* Add CC if cc recipiants are available
* Add CC if cc recipiants are available
*/
*/
if
len
(
cc
)
>
0
{
if
len
(
cc
)
>
0
{
message
.
AddCC
(
cc
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
time
.
Second
*
30
)
defer
cancel
()
message
.
AddCC
(
ctx
,
cc
)
}
}
resp
,
id
,
err
:=
mg
.
Send
(
message
)
resp
,
id
,
err
:=
mg
.
Send
(
message
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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