.
*
*/
namespace Friendica\Object\EMail;
use Friendica\App;
use Friendica\App\BaseURL;
use Friendica\Content\Text\HTML;
use Friendica\Core\L10n;
use Friendica\Model\Item;
use Friendica\Object\Email;
use Friendica\Protocol\Email as EmailProtocol;
/**
* Class for creating CC emails based on a received item
*/
class ItemCCEMail extends Email
{
public function __construct(App $a, L10n $l10n, BaseURL $baseUrl, array $item, string $toAddress, string $authorThumb)
{
$disclaimer = '
' . $l10n->t('This message was sent to you by %s, a member of the Friendica social network.', $a->getUserValue('username'))
. '
';
$disclaimer .= $l10n->t('You may visit them online at %s', $baseUrl . '/profile/' . $a->getNickname()) . EOL;
$disclaimer .= $l10n->t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
if (!$item['title'] == '') {
$subject = EmailProtocol::encodeHeader($item['title'], 'UTF-8');
} else {
$subject = EmailProtocol::encodeHeader('[Friendica]' . ' ' . $l10n->t('%s posted an update.', $a->getUserValue('username')), 'UTF-8');
}
$link = '
';
$html = Item::prepareBody($item);
$message = '' . $link . $html . $disclaimer . '';;
parent::__construct($a->getUserValue('username'), $a->getUserValue('email'), $a->getUserValue('email'), $toAddress,
$subject, $message, HTML::toPlaintext($html . $disclaimer));
}
}