. * */ namespace Friendica\Addon\securemail; use Friendica\App; use Friendica\App\BaseURL; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\Session; use Friendica\Model\User; use Friendica\Object\Email; /** * Class for creating a Test email for the securemail addon */ class SecureTestEmail extends Email { public function __construct(App $a, IManageConfigValues $config, IManagePersonalConfigValues $pConfig, BaseURL $baseUrl) { $sitename = $config->get('config', 'sitename'); $hostname = $baseUrl->getHostname(); if (strpos($hostname, ':')) { $hostname = substr($hostname, 0, strpos($hostname, ':')); } $sender_email = $config->get('config', 'sender_email'); if (empty($sender_email)) { $sender_email = 'noreply@' . $hostname; } $user = User::getById(Session::getLocalUser()); $subject = 'Friendica - Secure Mail - Test'; $message = 'This is a test message from your Friendica Secure Mail addon.'; // enable addon for test $pConfig->set(Session::getLocalUser(), 'securemail', 'enable', 1); parent::__construct($sitename, $sender_email, $sender_email, $user['email'], $subject, "

{$message}

", $message, [], Session::getLocalUser()); } }