death-notifier/src/main/php/com/fwdekker/deathnotifier/mailer/NotifyArticleDeletedEmail.php

60 lines
1.7 KiB
PHP

<?php
namespace com\fwdekker\deathnotifier\mailer;
/**
* An email to inform a user that a tracked article has been deleted.
*/
class NotifyArticleDeletedEmail extends Email
{
/**
* A string identifying the type of email.
*/
public const TYPE = "notify-article-deleted";
/**
* @var string The name of the article that was deleted.
*/
public string $name;
/**
* Constructs an email to inform a user that a tracked article has been deleted.
*
* @param string $recipient the intended recipient of the email
* @param string $name the name of the article that was deleted
*/
public function __construct(string $recipient, string $name)
{
$this->type = self::TYPE;
$this->recipient = $recipient;
$this->name = $name;
$this->arg1 = $name;
}
public function getSubject(): string
{
return "$this->name article has been deleted";
}
public function getBody(array $config): string
{
$base_path = $config["server"]["base_path"];
return
"The Wikipedia article about $this->name has been deleted. " .
"Death Notifier is now unable to send you a notification if $this->name dies. " .
"If the Wikipedia article is ever re-created, Death Notifier will automatically resume tracking this " .
"article, and you will receive another notification." .
"\n\n" .
"You are receiving this message because of the preferences in your Death Notifier account. " .
"To unsubscribe from these messages, go to the Death Notifier website, log in, and change your email " .
"preferences." .
"\n\n" .
$base_path;
}
}