Linked emailbackup email accounts to company wide settings in firmendaten

-> To do: clean up emailbackup accounts with smtp / imap settings
This commit is contained in:
Xenomporio 2022-06-26 18:15:30 +02:00
parent e8dea5a81b
commit d59b7da9a2
4 changed files with 32 additions and 34 deletions

View File

@ -139,6 +139,7 @@ final class SystemMailer
&& $account->getSmtpAuthType() !== EmailBackupAccount::AUTH_GMAIL && $account->getSmtpAuthType() !== EmailBackupAccount::AUTH_GMAIL
) )
) { ) {
$mailerror_text = 'Authtype error.';
return false; return false;
} }

View File

@ -29734,7 +29734,7 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
function GetSelectEmailMitName($selected="") function GetSelectEmailMitName($selected="")
{ {
$own = $this->app->User->GetEmail(); /* $own = $this->app->User->GetEmail();
$name = $this->app->User->GetName(); $name = $this->app->User->GetName();
$selected = str_replace(' <',' &lt;',$selected); $selected = str_replace(' <',' &lt;',$selected);
@ -29769,9 +29769,14 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
} }
$email_addr = $this->app->DB->SelectArr("SELECT if(smtp_frommail!='',smtp_frommail,email) as email,smtp_fromname FROM emailbackup WHERE (smtp_frommail!='' OR email!='') AND (adresse<=0 OR adresse='".$this->app->User->GetAdresse()."') AND geloescht!=1 ORDER BY email"); $email_addr = $this->app->DB->SelectArr("SELECT if(smtp_frommail!='',smtp_frommail,email) as email,smtp_fromname FROM emailbackup WHERE (smtp_frommail!='' OR email!='') AND (adresse<=0 OR adresse='".$this->app->User->GetAdresse()."') AND geloescht!=1 ORDER BY email");
*/
// Force only existing emailbackup accounts
$email_addr = $this->app->DB->SelectArr("SELECT email, angezeigtername FROM emailbackup WHERE email != '' AND (adresse<=0 OR adresse='".$this->app->User->GetAdresse()."') AND geloescht!=1 ORDER BY email");
foreach($email_addr AS $mail) foreach($email_addr AS $mail)
{ {
if($mail['smtp_fromname']!="") $emails[] = $mail['smtp_fromname']." &lt;".$mail['email']."&gt;"; if($mail['angezeigtername']!="") $emails[] = $mail['angezeigtername']." &lt;".$mail['email']."&gt;";
else $emails[] = $firmenname." &lt;".$mail['email']."&gt;"; else $emails[] = $firmenname." &lt;".$mail['email']."&gt;";
} }
@ -29789,6 +29794,7 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
function GetSelectEmail($selected="") function GetSelectEmail($selected="")
{ {
/*
$own = $this->app->User->GetEmail(); $own = $this->app->User->GetEmail();
$email_addr= $this->Firmendaten("email"); $email_addr= $this->Firmendaten("email");
@ -29804,16 +29810,28 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
$emails[] = $email_addr; $emails[] = $email_addr;
$email_addr = $this->app->DB->SelectArr("SELECT if(smtp_frommail!='',smtp_frommail,email) as email FROM emailbackup WHERE (smtp_frommail!='' OR email!='') AND (adresse<=0 OR adresse='".$this->app->User->GetAdresse()."') AND geloescht!=1 ORDER BY email"); $email_addr = $this->app->DB->SelectArr("SELECT if(smtp_frommail!='',smtp_frommail,email) as email FROM emailbackup WHERE (smtp_frommail!='' OR email!='') AND (adresse<=0 OR adresse='".$this->app->User->GetAdresse()."') AND geloescht!=1 ORDER BY email");
foreach($email_addr AS $mail) */
// Force only existing emailbackup accounts
$email_addr = $this->app->DB->SelectArr("SELECT email FROM emailbackup WHERE email != '' AND (adresse<=0 OR adresse='".$this->app->User->GetAdresse()."') AND geloescht!=1 ORDER BY email");
foreach($email_addr AS $mail) {
$emails[] = $mail['email']; $emails[] = $mail['email'];
}
$emails = array_keys(array_flip($emails)); $emails = array_keys(array_flip($emails));
for($i=0;$i<(!empty($emails)?count($emails):0);$i++) for($i=0;$i<(!empty($emails)?count($emails):0);$i++)
{ {
if($emails[$i]==$selected) $mark="selected"; else $mark=""; if($emails[$i]==$selected) {
$mark="selected";
}
else {
$mark="";
}
$tpl .="<option value=\"{$emails[$i]}\" $mark>{$emails[$i]}</option>"; $tpl .="<option value=\"{$emails[$i]}\" $mark>{$emails[$i]}</option>";
} }
return $tpl; return $tpl;
} }

View File

@ -99,13 +99,6 @@
document.forms[0].elements['footer[3][4]'].value = ""; document.forms[0].elements['footer[3][4]'].value = "";
document.forms[0].elements['footer[3][5]'].value = ""; document.forms[0].elements['footer[3][5]'].value = "";
document.forms[0].benutzername.value = "musterman";
document.forms[0].passwort.value = "passwort";
document.forms[0].host.value = "smtp.server.de";
document.forms[0].port.value = "25";
document.forms[0].ssl.checked = true;
document.forms[0].email.value = "info@server.de"; document.forms[0].email.value = "info@server.de";
document.forms[0].absendername.value = "Meine Firma"; document.forms[0].absendername.value = "Meine Firma";
document.forms[0].signatur.value = "--\n" document.forms[0].signatur.value = "--\n"
@ -663,19 +656,11 @@
<div class="row-height"> <div class="row-height">
<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 id="fieldset-mailversand-einstellungen"> <fieldset>
<legend>{|Versand Einstellungen|}</legend> <legend>Standard Einstellung E-Mail (bei Versand von E-Mails)</legend>
<table cellspacing="5" width="100%"> <table cellspacing="5" width="100%">
<tr><td width="300">Benutzername (E-Mail):&nbsp;</td><td><input type="text" name="benutzername" size="40" value="[BENUTZERNAME]"></td></tr>
<tr><td>Passwort:&nbsp;</td><td><input type="password" name="passwort" size="40" value="[PASSWORT]" AUTOCOMPLETE="off"></td></tr>
<tr><td>Postausgangsserver:&nbsp;</td><td><input type="text" name="host" size="40" value="[HOST]"></td></tr>
<tr><td>Port:&nbsp;</td><td><input type="text" name="port" size="4" value="[PORT]"></td></tr>
<tr><td width="50">Verschl&uuml;sselung:</td><td><select name="mailssl"><option value="0">keine</option><option value="1" [TLS]>TLS</option><option value="2" [SSL]>SSL</option></select></td></tr>
<tr><td>Testmail Empf&auml;nger:&nbsp;</td><td><input type="text" name="testmailempfaenger" size="40" value="[TESTMAILEMPFAENGER]"></td></tr> <tr><td>Testmail Empf&auml;nger:&nbsp;</td><td><input type="text" name="testmailempfaenger" size="40" value="[TESTMAILEMPFAENGER]"></td></tr>
<tr><td width="50">Testmail:</td><td><input type="submit" name="submitFirmendaten" onclick="$('#firmendatenform').attr('action','#tabs-4');" value="Speichern">&nbsp;<input type="button" value="Testmail senden" id="testmail-senden-button">&nbsp;<i>Bitte erst speichern und dann senden!</i></td></tr> <tr><td width="50">Testmail:</td><td><input type="button" value="Testmail senden" id="testmail-senden-button">&nbsp;<i>Bitte erst speichern und dann senden!</i></td></tr>
<tr><td width="50">PHP mail() verwenden (nur in Ausnahme!):</td><td><input type="checkbox" name="mailanstellesmtp" [MAILANSTELLESMTP]></td></tr>
<tr><td width="50">Keine SMTP Authentifizierung:</td><td><input type="checkbox" name="noauth" [NOAUTH]></td></tr>
<!--<tr><td align="center"></td><td><input type="button" name="testmail" value="Testmail schicken (zum Account Testen)"></td></tr>-->
</table> </table>
</fieldset> </fieldset>
</div> </div>
@ -690,7 +675,9 @@
<fieldset> <fieldset>
<legend>Standard Einstellung E-Mail (bei Versand von E-Mails)</legend> <legend>Standard Einstellung E-Mail (bei Versand von E-Mails)</legend>
<table cellspacing="5" width="100%"> <table cellspacing="5" width="100%">
<tr><td width="300">E-Mailadresse:</td><td><input type="text" name="email" value="[EMAIL]" size="40"></td> <tr><td width="300">E-Mailadresse:</td><td><select name="email">
[EMAIL]
</select></td>
<tr><td>Name des Absenders:</td><td><input type="text" name="absendername" value="[ABSENDERNAME]" size="40"></td> <tr><td>Name des Absenders:</td><td><input type="text" name="absendername" value="[ABSENDERNAME]" size="40"></td>
<tr><td>Standardsignatur:</td><td><textarea name="signatur" id="signatur" rows="15" cols="80">[SIGNATUR]</textarea></td> <tr><td>Standardsignatur:</td><td><textarea name="signatur" id="signatur" rows="15" cols="80">[SIGNATUR]</textarea></td>
<tr><td>Standard Gru&szlig;formel:</td><td><textarea name="mailgrussformel" id="mailgrussformel" rows="5" cols="80" data-lang="mailgrussformel">[MAILGRUSSFORMEL]</textarea>&nbsp;<i>Variable Absendername {MITARBEITER}</i></td> <tr><td>Standard Gru&szlig;formel:</td><td><textarea name="mailgrussformel" id="mailgrussformel" rows="5" cols="80" data-lang="mailgrussformel">[MAILGRUSSFORMEL]</textarea>&nbsp;<i>Variable Absendername {MITARBEITER}</i></td>

View File

@ -1711,19 +1711,11 @@ class Firmendaten {
$this->app->Tpl->Set('HINTERGRUNDBRIEFPAPIER2TEXT', "<a class=\"button\" href=\"index.php?module=firmendaten&action=briefpapier&cmd=briefpapier2\">PDF herunterladen</a>"); $this->app->Tpl->Set('HINTERGRUNDBRIEFPAPIER2TEXT', "<a class=\"button\" href=\"index.php?module=firmendaten&action=briefpapier&cmd=briefpapier2\">PDF herunterladen</a>");
} }
//Versand E-Mail
$this->app->Tpl->Set('BENUTZERNAME' , $data[0]['benutzername']);
$this->app->Tpl->Set('PASSWORT' , $data[0]['passwort']);
$this->app->Tpl->Set('HOST' , $data[0]['host']);
$this->app->Tpl->Set('PORT' , $data[0]['port']);
if($data[0]['mailssl']=="2")
$this->app->Tpl->Set('SSL' , "selected");
else if($data[0]['mailssl']=="1")
$this->app->Tpl->Set('TLS' , "selected");
// Signatur // Signatur
$this->app->Tpl->Set('SIGNATUR' , base64_decode($data[0]['signatur'])); $this->app->Tpl->Set('SIGNATUR' , base64_decode($data[0]['signatur']));
$this->app->Tpl->Set('EMAIL' , $data[0]['email']);
$this->app->Tpl->Set('EMAIL', $this->app->erp->GetSelectEmail($data[0]['email']));
$this->app->Tpl->Set('ABSENDERNAME' , $data[0]['absendername']); $this->app->Tpl->Set('ABSENDERNAME' , $data[0]['absendername']);
$this->app->Tpl->Set('BCC1' , $data[0]['bcc1']); $this->app->Tpl->Set('BCC1' , $data[0]['bcc1']);
$this->app->Tpl->Set('BCC2' , $data[0]['bcc2']); $this->app->Tpl->Set('BCC2' , $data[0]['bcc2']);