Umbau EMail-Versand auf phpMailer
Bereinigung alte Revisionierung TCPDF
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
//include "funktionen.php";
|
|
||||||
include "variablen.php";
|
include "variablen.php";
|
||||||
include "konstanten.php";
|
include "konstanten.php";
|
||||||
include __DIR__ . "/../config/content_de.php";
|
include __DIR__ . "/../config/content_de.php";
|
||||||
require_once(__DIR__ . '/tcpdf/tcpdf.php');
|
|
||||||
@@ -1,57 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$fileatt = $_POST['Attached'];
|
$phpMailer = new PHPMailer();
|
||||||
$fileatt_name = $_POST['ID'];
|
$phpMailer->From = $_POST['Email_from'];
|
||||||
$email_from = $_POST['Name_from'] . " <" . $_POST['Email_from'] . ">";
|
$phpMailer->FromName = $_POST['Name_from'];
|
||||||
$email_subject = $_POST['Subject'];
|
$phpMailer->CharSet = 'UTF-8';
|
||||||
$email_message = $_POST['Text'];
|
$phpMailer->isSendmail();
|
||||||
//$email_message =
|
$phpMailer->addReplyTo($_POST['Email_from']);
|
||||||
$email_to = $_POST['Email_to'];
|
$phpMailer->addAddress($_POST['Email_to']);
|
||||||
|
$phpMailer->addBCC($_POST['Email_from']);
|
||||||
|
$phpMailer->isHtml(false);
|
||||||
|
$phpMailer->Subject = $email_subject;
|
||||||
|
$phpMailer->Body = $_POST['Text'];
|
||||||
|
$phpMailer->addAttachment($_POST['Attached']);
|
||||||
|
$phpMailer->send();
|
||||||
|
|
||||||
$fileatt_type = "application/octet-stream"; // File Type
|
$ok = $phpMailer->ErrorInfo;
|
||||||
|
if ($ok !== '')
|
||||||
$headers = "From: " . $email_from . "\n";
|
|
||||||
$headers .= "Reply-To: " . $email_from . "\n";
|
|
||||||
if ("1" == $_SESSION['Firma']['Email_Kopie'])
|
|
||||||
{
|
|
||||||
$headers .= "BCC: <" . $_SESSION['Firma']['Email'] . ">";
|
|
||||||
}
|
|
||||||
|
|
||||||
$file = fopen($fileatt, 'rb');
|
|
||||||
$data = fread($file, filesize($fileatt));
|
|
||||||
fclose($file);
|
|
||||||
|
|
||||||
$semi_rand = md5(time());
|
|
||||||
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
|
|
||||||
|
|
||||||
$headers .= "\nMIME-Version: 1.0\n" .
|
|
||||||
"Content-Type: multipart/mixed;\n" .
|
|
||||||
" boundary=\"{$mime_boundary}\"";
|
|
||||||
|
|
||||||
$email_message = "This is a multi-part message in MIME format.\n\n" .
|
|
||||||
"--{$mime_boundary}\n" .
|
|
||||||
"Content-Type:text; charset=\"utf-8\"\n" .
|
|
||||||
"Content-Transfer-Encoding: 8bit\n\n" .
|
|
||||||
$email_message . "\n\n";
|
|
||||||
|
|
||||||
$data = chunk_split(base64_encode($data));
|
|
||||||
|
|
||||||
$email_message .= "--{$mime_boundary}\n" .
|
|
||||||
"Content-Type: {$fileatt_type};\n" .
|
|
||||||
" name=\"{$fileatt_name}\"\n" .
|
|
||||||
//"Content-Disposition: attachment;\n" .
|
|
||||||
//" filename=\"{$fileatt_name}\"\n" .
|
|
||||||
"Content-Transfer-Encoding: base64\n\n" .
|
|
||||||
$data . "\n\n" .
|
|
||||||
"--{$mime_boundary}--\n";
|
|
||||||
|
|
||||||
$ok = @mail($email_to, $email_subject, $email_message, $headers);
|
|
||||||
|
|
||||||
if (!$ok)
|
|
||||||
{
|
{
|
||||||
die("<h1>Die Nachricht konnte nicht versendet werden. Bitte gehen Sie zurück und versuchen Sie es noch einmal!</h1>");
|
die("<h1>Die Nachricht konnte nicht versendet werden. Bitte gehen Sie zurück und versuchen Sie es noch einmal!</h1>");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "<h1>Die Email wurde erfolgreich versendet.</h1>\n";
|
echo "<h1>Die Email wurde erfolgreich versendet.</h1>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user