[kronolith] Calendar event alarm reminders via e-mail
Aria Bamdad
aria at bsc.gwu.edu
Mon Jan 27 20:42:39 UTC 2020
> > Thank you Michael, I will open an enhancement request. In the
> > meantime, since if no e-mail address is provided to Kronolith via
> > the configuration screen, then horde_Alarm will assume the default
> > identity is the 'from' identity, then it is conceivable that I can
> > easily create a local modification to horde_alarm to always assume
> > the from address is the default identity and the to address is what
> > is provide via the kronolith configuration screen.
>
> > Do you think this would have negative impact on other
> > modules/functions that rely on horde_alarm?
>
> Well, you can't just hard code the kronolith configuration accessor
> into Horde_Alarm, since this would cause it to always use this address
> regardless of what Alarm is being triggered. Not to mention that
> Kronolith won't always be in scope when that code is reached, causing
> it to fatally fail. This is why Horde_Alarm either has to be extended
> to accept a separate from/to address, or, as suggested, more tightly
> integrate the Identity system with Kronolith.
>
> > Can you point me to the correct code segment that this is done in?
>
> https://github.com/horde/Alarm/blob/master/lib/Horde/Alarm/Handler/Mail.
> php
>
Thank you Michael. I have opened an enhancement request: https://bugs.horde.org/ticket/14983
However, I am a bit confused about why we can't locally change the horde_alarm mail handler you provided a link to above as follows to achieve the goal:
if (empty($alarm['params']['mail']['email'])) {
if (empty($alarm['user'])) {
return;
}
$email = $this->_identity
->create($alarm['user'])
->getDefaultFromAddress(true);
} else {
$email = $alarm['params']['mail']['email'];
}
Change above so that it always sets $from-email to $this->_identity ->create($alarm['user'])->getDefaultFromAddress(true);
And, then sets $to-email to $alarm['params']['mail']['email'] if it's not empty or else, sets it to $from-email.
Then in the next section below, use from-email and to-email instead of $email for both?
try {
$mail = new Horde_Mime_Mail(array(
'Subject' => $alarm['title'],
'To' => $email,
'From' => $email,
'Auto-Submitted' => 'auto-generated',
'X-Horde-Alarm' => $alarm['title']));
if (isset($alarm['params']['mail']['mimepart'])) {
$mail->setBasePart($alarm['params']['mail']['mimepart']);
} elseif (empty($alarm['params']['mail']['body'])) {
$mail->setBody($alarm['text']);
} else {
$mail->setBody($alarm['params']['mail']['body']);
}
This may be a naive solution as I am not a PHP programmer!
Thanks,
Aria
More information about the kronolith
mailing list