mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-24 13:40:29 +01:00
Bugfix for email address handling in ticket system
This commit is contained in:
parent
fd076040c2
commit
eed70bf673
@ -32458,6 +32458,7 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
|
||||
|
||||
/*
|
||||
* Return 0 = not ok, return 1 = ok
|
||||
* $to, $to_name, $cc, $bcc can be csv or arrays
|
||||
*/
|
||||
function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$projekt="",$signature=true,$cc="",$bcc="", $system = false)
|
||||
{
|
||||
@ -32551,23 +32552,30 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
|
||||
|
||||
$recipients = [];
|
||||
|
||||
$to_csv = "";
|
||||
$to_name_csv = "";
|
||||
|
||||
// Prepare names and addresses
|
||||
if (is_array($to)) {
|
||||
foreach ($to as $item) {
|
||||
$to_array[] = $item;
|
||||
$to_csv .= $item;
|
||||
}
|
||||
} else if (!empty($to)) {
|
||||
foreach (explode(',',str_replace(" ","",$to)) as $item) {
|
||||
$to_array[] = $item;
|
||||
$to_csv .= $item;
|
||||
}
|
||||
}
|
||||
if (is_array($to_name)) {
|
||||
foreach ($to_name as $item) {
|
||||
$to_name_array[] = $item;
|
||||
$to_name_csv .= $item;
|
||||
}
|
||||
} else if (!empty($to_name)) {
|
||||
foreach (explode(',',str_replace(" ","",$to_name)) as $item) {
|
||||
$to_name_array[] = $item;
|
||||
$to_name_csv .= $item;
|
||||
}
|
||||
}
|
||||
|
||||
@ -32639,7 +32647,8 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
|
||||
}
|
||||
|
||||
if($sysMailerSent === false) {
|
||||
$this->MailLogFile($from,$from_name,$to,$to_name,$betreff,$text,$files,$projekt,$signature,$cc,$bcc,$system);
|
||||
|
||||
$this->MailLogFile($from,$from_name,$to_csv,$to_name_csv,$betreff,$text,$files,$projekt,$signature,$cc,$bcc,$system);
|
||||
$this->mail_error = "Mailer Error: " . $sendmail_error;
|
||||
|
||||
if(isset($this->app->User) && $this->app->User && method_exists($this->app->User, 'GetID'))
|
||||
@ -32649,14 +32658,14 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
|
||||
return 0;
|
||||
} else {
|
||||
|
||||
$this->MailLogFile($from,$from_name,$to,$to_name,$betreff,$text,$files,$projekt,$signature,$cc,$bcc,$system);
|
||||
$this->MailLogFile($from,$from_name,$to_csv,$to_name_csv,$betreff,$text,$files,$projekt,$signature,$cc,$bcc,$system);
|
||||
|
||||
// Put the mail in IMAP sent folder
|
||||
// Note that this is implemented with laminas-mail and only this
|
||||
// The created mail may differ from the sent one because it is created by different libraries
|
||||
|
||||
$imap_aktiv = $this->app->DB->Select("SELECT imap_sentfolder_aktiv FROM emailbackup WHERE email='".$from."' AND imap_sentfolder!='' AND geloescht!=1 LIMIT 1");
|
||||
if($imap_aktiv=="1" && !preg_match("/Xentral Kopie/",$to_name) && !preg_match("/WaWision Kopie/",$to_name))
|
||||
if($imap_aktiv=="1" && !preg_match("/Xentral Kopie/",$to_name_csv) && !preg_match("/WaWision Kopie/",$to_name_csv))
|
||||
{
|
||||
|
||||
// This will build the mail as EmailMessage (Xentral\Components\Mailer\Data) and then rebuild it with laminas-mail message to produce the raw output
|
||||
|
@ -279,10 +279,12 @@ class Ticket {
|
||||
continue;
|
||||
}
|
||||
$this->app->Tpl->Set("NACHRICHT_BETREFF",$message['betreff']." (Entwurf)");
|
||||
} else {
|
||||
$this->app->Tpl->Set("NACHRICHT_BETREFF",$message['betreff']);
|
||||
}
|
||||
$this->app->Tpl->Set("NACHRICHT_SENDER",$message['mail_replyto']." (".$message['verfasser'].")");
|
||||
$this->app->Tpl->Set("NACHRICHT_RECIPIENTS",$message['mail']);
|
||||
$this->app->Tpl->Set("NACHRICHT_CC_RECIPIENTS",$message['mail_cc']);
|
||||
$this->app->Tpl->Set("NACHRICHT_SENDER",htmlentities($message['verfasser']." <".$message['mail_replyto'].">"));
|
||||
$this->app->Tpl->Set("NACHRICHT_RECIPIENTS",htmlentities($message['mail']));
|
||||
$this->app->Tpl->Set("NACHRICHT_CC_RECIPIENTS",htmlentities($message['mail_cc']));
|
||||
$this->app->Tpl->Set("NACHRICHT_FLOAT","right");
|
||||
$this->app->Tpl->Set("NACHRICHT_ZEIT",$message['zeitausgang']);
|
||||
$this->app->Tpl->Set("NACHRICHT_NAME",$message['verfasser']);
|
||||
@ -630,8 +632,14 @@ class Ticket {
|
||||
// Attachments
|
||||
$files = $this->app->erp->GetDateiSubjektObjektDateiname('Anhang','Ticket',$drafted_messages[0]['id'],"");
|
||||
|
||||
$pattern = '/[a-z0-9_\-\+\.]+@[a-z0-9\-]+\.([a-z]{2,4})(?:\.[a-z]{2})?/i';
|
||||
preg_match_all($pattern, $drafted_messages[0]['mail'], $matches);
|
||||
$to = $matches[0];
|
||||
|
||||
if ($drafted_messages[0]['mail_cc'] != '') {
|
||||
$cc = explode(',',$drafted_messages[0]['mail_cc']);
|
||||
$pattern = '/[a-z0-9_\-\+\.]+@[a-z0-9\-]+\.([a-z]{2,4})(?:\.[a-z]{2})?/i';
|
||||
preg_match_all($pattern, $drafted_messages[0]['mail_cc'], $matches);
|
||||
$cc = $matches[0];
|
||||
} else {
|
||||
$cc = null;
|
||||
}
|
||||
@ -640,8 +648,8 @@ class Ticket {
|
||||
$this->app->erp->MailSend(
|
||||
$drafted_messages[0]['mail_replyto'],
|
||||
$drafted_messages[0]['verfasser_replyto'],
|
||||
$drafted_messages[0]['mail'],
|
||||
$drafted_messages[0]['mail'],
|
||||
$to,
|
||||
$to,
|
||||
$drafted_messages[0]['betreff'],
|
||||
$drafted_messages[0]['text'],
|
||||
$files,
|
||||
|
Loading…
Reference in New Issue
Block a user