Improvement of emailbackup page including button for SMTP test

This commit is contained in:
Xenomporio 2022-06-28 17:01:23 +02:00
parent be14c7b8df
commit 33b73f56aa
2 changed files with 152 additions and 47 deletions

View File

@ -17,49 +17,117 @@
<div class="col-xs-12 col-md-12 col-md-height"> <div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height"> <div class="inside inside-full-height">
<fieldset> <fieldset>
<legend>{|<!--Legend for this form area goes here>-->emailbackup|}</legend> <legend>{|Allgemein|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|E-Mail-Adresse|}:</td><td><input type="text" name="email" value="[EMAIL]" size="40"></td></tr>
<tr><td>{|Angezeigter Name|}:</td><td><input type="text" name="angezeigtername" value="[ANGEZEIGTERNAME]" size="40"></td></tr>
<tr><td>{|Interne Beschreibung|}:</td><td><input type="text" name="internebeschreibung" value="[INTERNEBESCHREIBUNG]" size="40"></td></tr>
<tr><td>{|Benutzername|}:</td><td><input type="text" name="benutzername" value="[BENUTZERNAME]" size="40"></td></tr>
<tr><td>{|Passwort|}:</td><td><input type="password" name="passwort" value="[PASSWORT]" size="40"></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|SMTP|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|SMTP benutzen|}:</td><td><input type="text" name="smtp_extra" value="[SMTP_EXTRA]" size="40"><i>0 = nein, 1 = ja</i></td></tr>
<tr><td>{|Server|}:</td><td><input type="text" name="smtp" value="[SMTP]" size="40"></td></tr>
<tr><td>{|Verschl&uuml;sselung|}:</td><td><input type="text" name="smtp_ssl" value="[SMTP_SSL]" size="40"><i>0 = keine, 1 = TLS, 2 = SSL</i></td></tr>
<tr><td>{|Port|}:</td><td><input type="text" name="smtp_port" value="[SMTP_PORT]" size="40"></td></tr>
<tr><td>{|Authtype|}:</td><td><input type="text" name="smtp_authtype" value="[SMTP_AUTHTYPE]" size="40"><i>'', 'smtp', 'oauth_google'</i></td></tr>
<tr><td>{|Authparam|}:</td><td><input type="text" name="smtp_authparam" value="[SMTP_AUTHPARAM]" size="40"></td></tr>
<tr><td>{|Client_alias|}:</td><td><input type="text" name="client_alias" value="[CLIENT_ALIAS]" size="40"></td></tr>
<tr><td>{|Loglevel|}:</td><td><input type="text" name="smtp_loglevel" value="[SMTP_LOGLEVEL]" size="40"></td></tr>
<tr><td width="50">Testmail:</td><td>
<input type="submit" form="smtp_test" value="Testmail senden" id="testmail-senden-button">&nbsp;<i>Bitte erst speichern und dann senden!</i>
</td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|IMAP|}</legend>
<table width="100%" border="0" class="mkTableFormular"> <table width="100%" border="0" class="mkTableFormular">
<tr><td>{|email|}:</td><td><input type="text" name="email" value="[EMAIL]" size="40"></td></tr>
<tr><td>{|angezeigtername|}:</td><td><input type="text" name="angezeigtername" value="[ANGEZEIGTERNAME]" size="40"></td></tr>
<tr><td>{|internebeschreibung|}:</td><td><input type="text" name="internebeschreibung" value="[INTERNEBESCHREIBUNG]" size="40"></td></tr>
<tr><td>{|benutzername|}:</td><td><input type="text" name="benutzername" value="[BENUTZERNAME]" size="40"></td></tr>
<tr><td>{|passwort|}:</td><td><input type="text" name="passwort" value="[PASSWORT]" size="40"></td></tr>
<tr><td>{|IMAP server|}:</td><td><input type="text" name="server" value="[SERVER]" size="40"></td></tr> <tr><td>{|IMAP server|}:</td><td><input type="text" name="server" value="[SERVER]" size="40"></td></tr>
<tr><td>{|SMTP server|}:</td><td><input type="text" name="smtp" value="[SMTP]" size="40"></td></tr>
<tr><td>{|ticket|}:</td><td><input type="text" name="ticket" value="[TICKET]" size="40"></td></tr>
<tr><td>{|imap_sentfolder_aktiv|}:</td><td><input type="text" name="imap_sentfolder_aktiv" value="[IMAP_SENTFOLDER_AKTIV]" size="40"></td></tr> <tr><td>{|imap_sentfolder_aktiv|}:</td><td><input type="text" name="imap_sentfolder_aktiv" value="[IMAP_SENTFOLDER_AKTIV]" size="40"></td></tr>
<tr><td>{|imap_sentfolder|}:</td><td><input type="text" name="imap_sentfolder" value="[IMAP_SENTFOLDER]" size="40"></td></tr> <tr><td>{|imap_sentfolder|}:</td><td><input type="text" name="imap_sentfolder" value="[IMAP_SENTFOLDER]" size="40"></td></tr>
<tr><td>{|imap_port|}:</td><td><input type="text" name="imap_port" value="[IMAP_PORT]" size="40"></td></tr> <tr><td>{|imap_port|}:</td><td><input type="text" name="imap_port" value="[IMAP_PORT]" size="40"></td></tr>
<tr><td>{|imap_type|}:</td><td><input type="text" name="imap_type" value="[IMAP_TYPE]" size="40"></td></tr> <tr><td>{|imap_type|}:</td><td><input type="text" name="imap_type" value="[IMAP_TYPE]" size="40"><i>0 = standard, 1 = SSL</i></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Archiv|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|E-Mailarchiv aktiv|}:</td><td><input type="text" name="emailbackup" value="[EMAILBACKUP]" size="40"></td></tr>
<tr><td>{|Löschen nach wievielen Tagen?|}:</td><td><input type="text" name="loeschtage" value="[LOESCHTAGE]" size="40"></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Ticketsystem|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|ticket|}:</td><td><input type="text" name="ticket" value="[TICKET]" size="40"></td></tr>
<tr><td>{|ticketprojekt|}:</td><td><input type="text" name="ticketprojekt" value="[TICKETPROJEKT]" size="40"></td></tr>
<tr><td>{|ticketqueue|}:</td><td><input type="text" name="ticketqueue" value="[TICKETQUEUE]" size="40"></td></tr>
<tr><td>{|abdatum|}:</td><td><input type="text" name="abdatum" value="[ABDATUM]" size="40"></td></tr>
<tr><td>{|ticketloeschen|}:</td><td><input type="text" name="ticketloeschen" value="[TICKETLOESCHEN]" size="40"></td></tr>
<tr><td>{|ticketabgeschlossen|}:</td><td><input type="text" name="ticketabgeschlossen" value="[TICKETABGESCHLOSSEN]" size="40"></td></tr>
<tr><td>{|ticketemaileingehend|}:</td><td><input type="text" name="ticketemaileingehend" value="[TICKETEMAILEINGEHEND]" size="40"></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Sonstiges|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|autosresponder_blacklist|}:</td><td><input type="text" name="autosresponder_blacklist" value="[AUTOSRESPONDER_BLACKLIST]" size="40"></td></tr>
<tr><td>{|eigenesignatur|}:</td><td><input type="text" name="eigenesignatur" value="[EIGENESIGNATUR]" size="40"></td></tr>
<tr><td>{|signatur|}:</td><td><input type="text" name="signatur" value="[SIGNATUR]" size="40"></td></tr>
<tr><td>{|adresse|}:</td><td><input type="text" name="adresse" value="[ADRESSE]" size="40"></td></tr>
<tr><td>{|firma|}:</td><td><input type="text" name="firma" value="[FIRMA]" size="40"></td></tr>
<tr><td>{|geloescht|}:</td><td><input type="text" name="geloescht" value="[GELOESCHT]" size="40"></td></tr>
<tr><td>{|mutex|}:</td><td><input type="text" name="mutex" value="[MUTEX]" size="40"></td></tr>
<tr><td>{|autoresponder|}:</td><td><input type="text" name="autoresponder" value="[AUTORESPONDER]" size="40"></td></tr> <tr><td>{|autoresponder|}:</td><td><input type="text" name="autoresponder" value="[AUTORESPONDER]" size="40"></td></tr>
<tr><td>{|geschaeftsbriefvorlage|}:</td><td><input type="text" name="geschaeftsbriefvorlage" value="[GESCHAEFTSBRIEFVORLAGE]" size="40"></td></tr> <tr><td>{|geschaeftsbriefvorlage|}:</td><td><input type="text" name="geschaeftsbriefvorlage" value="[GESCHAEFTSBRIEFVORLAGE]" size="40"></td></tr>
<tr><td>{|autoresponderbetreff|}:</td><td><input type="text" name="autoresponderbetreff" value="[AUTORESPONDERBETREFF]" size="40"></td></tr> <tr><td>{|autoresponderbetreff|}:</td><td><input type="text" name="autoresponderbetreff" value="[AUTORESPONDERBETREFF]" size="40"></td></tr>
<tr><td>{|autorespondertext|}:</td><td><input type="text" name="autorespondertext" value="[AUTORESPONDERTEXT]" size="40"></td></tr> <tr><td>{|autorespondertext|}:</td><td><input type="text" name="autorespondertext" value="[AUTORESPONDERTEXT]" size="40"></td></tr>
<tr><td>{|projekt|}:</td><td><input type="text" name="projekt" value="[PROJEKT]" size="40"></td></tr> <tr><td>{|projekt|}:</td><td><input type="text" name="projekt" value="[PROJEKT]" size="40"></td></tr>
<tr><td>{|emailbackup|}:</td><td><input type="text" name="emailbackup" value="[EMAILBACKUP]" size="40"></td></tr>
<tr><td>{|adresse|}:</td><td><input type="text" name="adresse" value="[ADRESSE]" size="40"></td></tr>
<tr><td>{|firma|}:</td><td><input type="text" name="firma" value="[FIRMA]" size="40"></td></tr>
<tr><td>{|loeschtage|}:</td><td><input type="text" name="loeschtage" value="[LOESCHTAGE]" size="40"></td></tr>
<tr><td>{|geloescht|}:</td><td><input type="text" name="geloescht" value="[GELOESCHT]" size="40"></td></tr>
<tr><td>{|ticketloeschen|}:</td><td><input type="text" name="ticketloeschen" value="[TICKETLOESCHEN]" size="40"></td></tr>
<tr><td>{|ticketabgeschlossen|}:</td><td><input type="text" name="ticketabgeschlossen" value="[TICKETABGESCHLOSSEN]" size="40"></td></tr>
<tr><td>{|ticketqueue|}:</td><td><input type="text" name="ticketqueue" value="[TICKETQUEUE]" size="40"></td></tr>
<tr><td>{|ticketprojekt|}:</td><td><input type="text" name="ticketprojekt" value="[TICKETPROJEKT]" size="40"></td></tr>
<tr><td>{|ticketemaileingehend|}:</td><td><input type="text" name="ticketemaileingehend" value="[TICKETEMAILEINGEHEND]" size="40"></td></tr>
<tr><td>{|smtp_extra|}:</td><td><input type="text" name="smtp_extra" value="[SMTP_EXTRA]" size="40"></td></tr>
<tr><td>{|smtp_ssl|}:</td><td><input type="text" name="smtp_ssl" value="[SMTP_SSL]" size="40"></td></tr>
<tr><td>{|smtp_port|}:</td><td><input type="text" name="smtp_port" value="[SMTP_PORT]" size="40"></td></tr>
<tr><td>{|smtp_frommail|}:</td><td><input type="text" name="smtp_frommail" value="[SMTP_FROMMAIL]" size="40"></td></tr>
<tr><td>{|smtp_fromname|}:</td><td><input type="text" name="smtp_fromname" value="[SMTP_FROMNAME]" size="40"></td></tr>
<tr><td>{|client_alias|}:</td><td><input type="text" name="client_alias" value="[CLIENT_ALIAS]" size="40"></td></tr>
<tr><td>{|smtp_authtype|}:</td><td><input type="text" name="smtp_authtype" value="[SMTP_AUTHTYPE]" size="40"></td></tr>
<tr><td>{|smtp_authparam|}:</td><td><input type="text" name="smtp_authparam" value="[SMTP_AUTHPARAM]" size="40"></td></tr>
<tr><td>{|smtp_loglevel|}:</td><td><input type="text" name="smtp_loglevel" value="[SMTP_LOGLEVEL]" size="40"></td></tr>
<tr><td>{|autosresponder_blacklist|}:</td><td><input type="text" name="autosresponder_blacklist" value="[AUTOSRESPONDER_BLACKLIST]" size="40"></td></tr>
<tr><td>{|eigenesignatur|}:</td><td><input type="text" name="eigenesignatur" value="[EIGENESIGNATUR]" size="40"></td></tr>
<tr><td>{|signatur|}:</td><td><input type="text" name="signatur" value="[SIGNATUR]" size="40"></td></tr>
<tr><td>{|mutex|}:</td><td><input type="text" name="mutex" value="[MUTEX]" size="40"></td></tr>
<tr><td>{|abdatum|}:</td><td><input type="text" name="abdatum" value="[ABDATUM]" size="40"></td></tr>
</table> </table>
</fieldset> </fieldset>
</div> </div>
@ -94,3 +162,9 @@
--> -->
</div> </div>
<form id="smtp_test" action = "index.php">
<input type="text" name="module" value="emailbackup" style="display:none">
<input type="text" name="action" value="test_smtp" style="display:none">
<input type="text" name="id" value="[ID]" style="display:none">
</form>

View File

@ -18,6 +18,8 @@ class Emailbackup {
$this->app->ActionHandler("create", "emailbackup_edit"); // This automatically adds a "New" button $this->app->ActionHandler("create", "emailbackup_edit"); // This automatically adds a "New" button
$this->app->ActionHandler("edit", "emailbackup_edit"); $this->app->ActionHandler("edit", "emailbackup_edit");
$this->app->ActionHandler("delete", "emailbackup_delete"); $this->app->ActionHandler("delete", "emailbackup_delete");
$this->app->ActionHandler("test_smtp",'emailbackup_test_smtp');
$this->app->DefaultActionHandler("list"); $this->app->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app); $this->app->ActionHandlerListen($app);
} }
@ -203,8 +205,8 @@ $width = array('10%'); // Fill out manually later
$input['smtp_extra'] = $this->app->Secure->GetPOST('smtp_extra'); $input['smtp_extra'] = $this->app->Secure->GetPOST('smtp_extra');
$input['smtp_ssl'] = $this->app->Secure->GetPOST('smtp_ssl'); $input['smtp_ssl'] = $this->app->Secure->GetPOST('smtp_ssl');
$input['smtp_port'] = $this->app->Secure->GetPOST('smtp_port'); $input['smtp_port'] = $this->app->Secure->GetPOST('smtp_port');
$input['smtp_frommail'] = $this->app->Secure->GetPOST('smtp_frommail'); $input['smtp_frommail'] = $this->app->Secure->GetPOST('email'); // use only these
$input['smtp_fromname'] = $this->app->Secure->GetPOST('smtp_fromname'); $input['smtp_fromname'] = $this->app->Secure->GetPOST('angezeigtername'); // use only these
$input['client_alias'] = $this->app->Secure->GetPOST('client_alias'); $input['client_alias'] = $this->app->Secure->GetPOST('client_alias');
$input['smtp_authtype'] = $this->app->Secure->GetPOST('smtp_authtype'); $input['smtp_authtype'] = $this->app->Secure->GetPOST('smtp_authtype');
$input['smtp_authparam'] = $this->app->Secure->GetPOST('smtp_authparam'); $input['smtp_authparam'] = $this->app->Secure->GetPOST('smtp_authparam');
@ -255,8 +257,6 @@ $width = array('10%'); // Fill out manually later
$this->app->Tpl->Set('SMTP_EXTRA', $input['smtp_extra']); $this->app->Tpl->Set('SMTP_EXTRA', $input['smtp_extra']);
$this->app->Tpl->Set('SMTP_SSL', $input['smtp_ssl']); $this->app->Tpl->Set('SMTP_SSL', $input['smtp_ssl']);
$this->app->Tpl->Set('SMTP_PORT', $input['smtp_port']); $this->app->Tpl->Set('SMTP_PORT', $input['smtp_port']);
$this->app->Tpl->Set('SMTP_FROMMAIL', $input['smtp_frommail']);
$this->app->Tpl->Set('SMTP_FROMNAME', $input['smtp_fromname']);
$this->app->Tpl->Set('CLIENT_ALIAS', $input['client_alias']); $this->app->Tpl->Set('CLIENT_ALIAS', $input['client_alias']);
$this->app->Tpl->Set('SMTP_AUTHTYPE', $input['smtp_authtype']); $this->app->Tpl->Set('SMTP_AUTHTYPE', $input['smtp_authtype']);
$this->app->Tpl->Set('SMTP_AUTHPARAM', $input['smtp_authparam']); $this->app->Tpl->Set('SMTP_AUTHPARAM', $input['smtp_authparam']);
@ -270,4 +270,35 @@ $width = array('10%'); // Fill out manually later
} }
function emailbackup_test_smtp() {
$id = $this->app->Secure->GetGET('id');
$result = $this->app->DB->SelectArr("SELECT angezeigtername, email FROM emailbackup WHERE id='$id' LIMIT 1");
if(
$this->app->erp->MailSend(
$result[0]['email'],
$result[0]['angezeigtername'],
$result[0]['email'],
$result[0]['angezeigtername'],
'Xenomporio ERP: Testmail',
'Dies ist eine Testmail',
'',0,true,'','',
true
)
) {
$msg = $this->app->erp->base64_url_encode(
'<div class="info">Die Testmail wurde erfolgreich versendet an '.$result[0]['email'].'. '.$this->app->erp->mail_error.'</div>'
);
}
else {
$msg = $this->app->erp->base64_url_encode(
'<div class="error">Die Testmail wurde nicht versendet: '.$this->app->erp->mail_error.'</div>'
);
}
$this->app->Location->execute("index.php?module=emailbackup&id=$id&action=edit&msg=$msg");
}
} }