CODE
include 'config.php';
include 'class.phpmailer.php';
$array = $_POST;
$id = md5(uniqid());
// CREATE FILE
touch('results/'.$id.'.csv');
$file = fopen('results/'.$id.'.csv', 'w');
$col = array();
$col[0] = array();
$col[1] = array();
foreach ($array as $key => $value)
{
if ( ! empty($value))
{
if ($key == 'POBRANIE') continue;
if ($key == 'U_RACH_POBRANIA') $value = trim($value);
if ($key == 'CK' AND $array['PLATNIK'] != 'ZL') $key = substr($array['PLATNIK'], 1).'_CK';
else if ($key == 'CK' AND $array['PLATNIK'] == 'ZL') continue;
$col[0][] = $key;
$col[1][] = $value;
}
}
$col[0][] = 'N_OS_NADAJACA';
$col[1][] = $array['N_NAZWA'];
fputcsv($file, $col[0], ';');
fputcsv($file, $col[1], ';');
fclose($file);
// SEND MAILS
$mail_handle = new PHPMailer();
$mail_handle->IsSMTP();
$mail_handle->Host = $connection['host'];
$mail_handle->Port = $connection['port'];
$mail_handle->SMTPAuth = true;
$mail_handle->Username = $connection['user'];
$mail_handle->Password = $connection['pswd'];
$mail_handle->SetFrom('kurier@costamcostam.pl', 'CSV Formularz - Bot');
foreach ($receivers as $item) $mail_handle->AddAddress($item);
$mail_handle->Subject = 'Formularz';
$mail_handle->CharSet = 'utf-8';
$mail_handle->Body = 'Formularz został wysłany';
$mail_handle->AddAttachment('results/'.$id.'.csv');
if ($mail_handle->Send())
$mail = true;
else
$mail = false;
include 'class.phpmailer.php';
$array = $_POST;
$id = md5(uniqid());
// CREATE FILE
touch('results/'.$id.'.csv');
$file = fopen('results/'.$id.'.csv', 'w');
$col = array();
$col[0] = array();
$col[1] = array();
foreach ($array as $key => $value)
{
if ( ! empty($value))
{
if ($key == 'POBRANIE') continue;
if ($key == 'U_RACH_POBRANIA') $value = trim($value);
if ($key == 'CK' AND $array['PLATNIK'] != 'ZL') $key = substr($array['PLATNIK'], 1).'_CK';
else if ($key == 'CK' AND $array['PLATNIK'] == 'ZL') continue;
$col[0][] = $key;
$col[1][] = $value;
}
}
$col[0][] = 'N_OS_NADAJACA';
$col[1][] = $array['N_NAZWA'];
fputcsv($file, $col[0], ';');
fputcsv($file, $col[1], ';');
fclose($file);
// SEND MAILS
$mail_handle = new PHPMailer();
$mail_handle->IsSMTP();
$mail_handle->Host = $connection['host'];
$mail_handle->Port = $connection['port'];
$mail_handle->SMTPAuth = true;
$mail_handle->Username = $connection['user'];
$mail_handle->Password = $connection['pswd'];
$mail_handle->SetFrom('kurier@costamcostam.pl', 'CSV Formularz - Bot');
foreach ($receivers as $item) $mail_handle->AddAddress($item);
$mail_handle->Subject = 'Formularz';
$mail_handle->CharSet = 'utf-8';
$mail_handle->Body = 'Formularz został wysłany';
$mail_handle->AddAttachment('results/'.$id.'.csv');
if ($mail_handle->Send())
$mail = true;
else
$mail = false;
Nie wiem jak mam wstawić wszystkie zmienne w body mail_handle.
jak zrobię tak: $mail_handle->Body = $POST['N_NAZWA']; wo wysyła zmienną z pola N_NAZWA, ale ni jak nie mogę wkleić tak kilka zmiennych..próbowałem ze średnikami, z przecinkami, bez niczego i nic...
proszę o pomoc i jakieś którkie wyjaśnienie.
dzięki