Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (3)
(chore): loop email iterator if no entities returned
· 0c777244
Mark Harding
authored
May 25, 2019
0c777244
(chore): dev code for promotions email
· 7546fd46
Mark Harding
authored
May 25, 2019
7546fd46
(chore): email promotions to use markdown and include template key in hash
· 827ae8e9
Mark Harding
authored
May 25, 2019
827ae8e9
Hide whitespace changes
Inline
Side-by-side
Core/Email/Batches/Promotion.php
View file @
827ae8e9
...
...
@@ -93,7 +93,13 @@ class Promotion implements EmailBatchInterface
$i
=
0
;
foreach
(
$iterator
as
$user
)
{
++
$i
;
echo
"
\n
[
$i
]:
$user->guid
"
;
// $user = new \Minds\Entities\User('markna');
// $user->bounced = false;
if
(
$user
->
bounced
)
{
echo
"
\n
[
$i
]:
$user->guid
(
$iterator->offset
) bounced"
;
continue
;
}
$campaign
=
new
Campaigns\Promotion
();
...
...
@@ -103,7 +109,8 @@ class Promotion implements EmailBatchInterface
->
setSubject
(
$this
->
subject
)
->
send
();
echo
' (queued)'
;
echo
"
\n
[
$i
]:
$user->guid
(
$iterator->offset
)"
;
// exit;
}
}
}
Core/Email/Campaigns/Promotion.php
View file @
827ae8e9
...
...
@@ -53,7 +53,8 @@ class Promotion extends EmailCampaign
throw
new
\Exception
(
'You must set a templatePath'
);
}
$this
->
template
->
setTemplate
(
'default.tpl'
);
$this
->
template
->
toggleMarkdown
(
true
);
$this
->
template
->
setBody
(
"./Templates/
$this->templateKey
.tpl"
);
$this
->
template
->
set
(
'user'
,
$this
->
user
);
...
...
@@ -65,7 +66,7 @@ class Promotion extends EmailCampaign
$this
->
template
->
set
(
'topic'
,
$this
->
topic
);
//do not reward twice
$validatorHash
=
sha1
(
$this
->
campaign
.
$this
->
topic
.
$this
->
user
->
guid
.
Config
::
_
()
->
get
(
'emails_secret'
));
$validatorHash
=
sha1
(
$this
->
campaign
.
$this
->
templateKey
.
$this
->
topic
.
$this
->
user
->
guid
.
Config
::
_
()
->
get
(
'emails_secret'
));
$this
->
template
->
set
(
'validator'
,
$validatorHash
);
$message
=
new
Message
();
...
...
@@ -76,8 +77,7 @@ class Promotion extends EmailCampaign
->
setHtml
(
$this
->
template
);
//send email
$this
->
mailer
->
queue
(
$message
);
exit
;
$this
->
mailer
->
send
(
$message
);
}
}
Core/Email/EmailSubscribersIterator.php
View file @
827ae8e9
...
...
@@ -125,7 +125,7 @@ class EmailSubscribersIterator implements \Iterator
$users
=
$this
->
builder
->
get
([
'guids'
=>
$guids
]);
if
(
!
$users
)
{
$this
->
valid
=
false
;
return
$this
->
getSubscribers
()
;
return
;
}
...
...