mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
parents-merge 35486 - Added option for getNameForEmail() function to be added to a member, which will create in an email template sent to that person
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@45053 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
cbbdd8c412
commit
d8709777c0
@ -46,32 +46,35 @@ class NewsletterEmailProcess extends BatchProcess {
|
||||
/**
|
||||
* Email Blacklisting Support
|
||||
*/
|
||||
if($member->BlacklistedEmail && Email_BlackList::isBlocked($address)){
|
||||
$bounceRecord = new Email_BounceRecord();
|
||||
$bounceRecord->BounceEmail = $member->Email;
|
||||
$bounceRecord->BounceTime = date("Y-m-d H:i:s",time());
|
||||
$bounceRecord->BounceMessage = "BlackListed Email";
|
||||
$bounceRecord->MemberID = $member->ID;
|
||||
$bounceRecord->write();
|
||||
if($member->BlacklistedEmail && Email_BlackList::isBlocked($address)){
|
||||
$bounceRecord = new Email_BounceRecord();
|
||||
$bounceRecord->BounceEmail = $member->Email;
|
||||
$bounceRecord->BounceTime = date("Y-m-d H:i:s",time());
|
||||
$bounceRecord->BounceMessage = "BlackListed Email";
|
||||
$bounceRecord->MemberID = $member->ID;
|
||||
$bounceRecord->write();
|
||||
|
||||
// Log the blacklist for this specific Newsletter
|
||||
$newsletter = new Newsletter_SentRecipient();
|
||||
$newsletter->Email = $address;
|
||||
$newsletter->MemberID = $member->ID;
|
||||
$newsletter->Result = 'BlackListed';
|
||||
$newsletter->ParentID = $this->newsletter->ID;
|
||||
$newsletter->write();
|
||||
} else {
|
||||
$e = new Newsletter_Email($this->nlType);
|
||||
// Log the blacklist for this specific Newsletter
|
||||
$newsletter = new Newsletter_SentRecipient();
|
||||
$newsletter->Email = $address;
|
||||
$newsletter->MemberID = $member->ID;
|
||||
$newsletter->Result = 'BlackListed';
|
||||
$newsletter->ParentID = $this->newsletter->ID;
|
||||
$newsletter->write();
|
||||
|
||||
} else {
|
||||
$e = new Newsletter_Email($this->nlType);
|
||||
$e->setBody( $this->body );
|
||||
$e->setSubject( $this->subject );
|
||||
$e->setFrom( $this->from );
|
||||
$e->setTemplate( $this->nlType->Template );
|
||||
|
||||
if(method_exists($member, "getNameForEmail"))
|
||||
$nameForEmail = $member->getNameForEmail();
|
||||
|
||||
$e->populateTemplate( array( 'Member' => $member, 'FirstName' => $member->FirstName ) );
|
||||
$this->sendToAddress( $e, $address, $this->messageID, $member);
|
||||
}
|
||||
$e->populateTemplate( array( 'Member' => $member, 'FirstName' => $member->FirstName, 'NameForEmail'=>$nameForEmail ) );
|
||||
$this->sendToAddress( $e, $address, $this->messageID, $member);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user