Ecodev / newsletter

TYPO3 extension to send newsletter
https://extensions.typo3.org/extension/newsletter/
25 stars 26 forks source link

Override sender_email and sender_name via Recipient List data #132

Closed PowerKiKi closed 7 years ago

PowerKiKi commented 7 years ago

@siwa-pparzer presented the following use-case by email:

I have a short question about your TYPO3 newsletter extension:Is it possible to set the sender-email address dynamically? Lets say I have 100 clients and 5 employees, every employee is the contact of 20 clients and has a different email address to repeat to. I could now send 5 newsletters with different addresses set manually in the setup. But I I have 1000 clients and 50 employees, I don't want to send 50 newsletters manually.In the manual I only found the solution with de be_user.

Then added:

I found a solution, but that is more like a workaround:

Classes/Mailer.php -> raw_send() ca. 374

if ($email->getRecipientData()["sender"]){
    $message->setFrom(array($email->getRecipientData()["sender"] => $email->getRecipientData()["sender"]));
} else {
    $message->setFrom(array($this->senderEmail => $this->senderName,));
}
$message->setSubject($this->title);

if ($this->replytoEmail) {
    $message->addReplyTo($this->replytoEmail, $this->replytoName);
} elseif ($email->getRecipientData()["sender"]){
    $message->addReplyTo($email->getRecipientData()["sender"], $email->getRecipientData()["sender"]);
}

We only would have to find a static word like i used „sender“ to identify the field (like the field „email“)

Is this a feature that should go into the main code or is this case too individual?

This sounds reasonable and simple enough to be merged in our code. I'll suggest an implementation shortly...

PowerKiKi commented 7 years ago

@siwa-pparzer can you please test the branch override-sender-email and let me know if it fits your use-case ?

siwa-pparzer commented 7 years ago

Yeah, thats perfect. Thanks, for the quick implementation

PowerKiKi commented 7 years ago

I'll give you a few more days to play with it, and if everything is still OK, I'll merge in master and release.

siwa-pparzer commented 7 years ago

Alright, thanks