76 lines
3.2 KiB
PHP
76 lines
3.2 KiB
PHP
<?php
|
|
class email_config extends rcube_plugin
|
|
{
|
|
public $task = 'settings';
|
|
|
|
function init()
|
|
{
|
|
$this->add_texts('localization/', false);
|
|
$this->add_hook('settings_actions', array($this, 'settings_actions'));
|
|
$this->register_action('plugin.email_config', array($this, 'email_config_init'));
|
|
}
|
|
|
|
function settings_actions($args)
|
|
{
|
|
$args['actions'][] = array(
|
|
'action' => 'plugin.email_config',
|
|
'class' => 'email-config',
|
|
'label' => 'email_config',
|
|
'domain' => 'email_config',
|
|
);
|
|
return $args;
|
|
}
|
|
|
|
function email_config_init()
|
|
{
|
|
$rcmail = rcube::get_instance();
|
|
$this->register_handler('plugin.body', array($this, 'email_config_form'));
|
|
$rcmail->output->set_pagetitle('Email Configuration');
|
|
$rcmail->output->send('plugin');
|
|
}
|
|
|
|
function email_config_form()
|
|
{
|
|
$rcmail = rcube::get_instance();
|
|
$email = $rcmail->user->get_username();
|
|
$secret_key = 'SHARED_SECRET_KEY_987654321';
|
|
$config_url = 'http://localhost:3008';
|
|
$expires = time() + 3600;
|
|
$data = $email . '|' . $expires;
|
|
$signature = hash_hmac('sha256', $data, $secret_key);
|
|
$url = $config_url . '/?email=' . urlencode($email) . '&expires=' . $expires . '&signature=' . $signature;
|
|
|
|
$out = '
|
|
<div class="box" style="max-width: 600px; margin: 40px auto; padding: 30px; background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
|
|
<div style="text-align: center; margin-bottom: 30px;">
|
|
<svg width="64" height="64" viewBox="0 0 24 24" fill="none" style="margin: 0 auto 20px;">
|
|
<path d="M20 4H4C2.9 4 2.01 4.9 2.01 6L2 18C2 19.1 2.9 20 4 20H20C21.1 20 22 19.1 22 18V6C22 4.9 21.1 4 20 4ZM20 8L12 13L4 8V6L12 11L20 6V8Z" fill="#4A90E2"/>
|
|
</svg>
|
|
<h2 style="margin: 0; color: #333; font-size: 24px; font-weight: 600;">Email Rules Configuration</h2>
|
|
</div>
|
|
|
|
<div style="background: #f8f9fa; padding: 20px; border-radius: 6px; margin-bottom: 25px;">
|
|
<p style="margin: 0 0 8px 0; color: #666; font-size: 14px;">Signed in as:</p>
|
|
<p style="margin: 0; color: #333; font-size: 16px; font-weight: 500;">' . htmlspecialchars($email) . '</p>
|
|
</div>
|
|
|
|
<p style="color: #666; line-height: 1.6; margin-bottom: 25px; text-align: center;">
|
|
Configure out-of-office auto-replies and email forwarding rules for your account.
|
|
</p>
|
|
|
|
<div style="text-align: center;">
|
|
<a href="' . htmlspecialchars($url) . '" target="_blank"
|
|
style="display: inline-block; background: #4A90E2; color: white; padding: 12px 32px;
|
|
border-radius: 6px; text-decoration: none; font-weight: 500; font-size: 16px;
|
|
transition: background 0.2s; box-shadow: 0 2px 4px rgba(74,144,226,0.3);"
|
|
onmouseover="this.style.background=\'#357ABD\'"
|
|
onmouseout="this.style.background=\'#4A90E2\'">
|
|
Open Email Configuration →
|
|
</a>
|
|
</div>
|
|
</div>';
|
|
|
|
return $out;
|
|
}
|
|
}
|