I have write send email with attachment. Like this:
require_once "Mail.php";
require_once "Mail/mime.php";
$from = 'testsenderserver@gmail.com_from';
$to = 'testsenderserver@gmail.com';
$subject = 'You got new order at ' . gmdate("Y-m-d\TH:i:s\Z");
// text and html versions of email.
$text = 'Name: ' . strip_tags($_POST['customerName']) . "\r\n" .
'Phone: ' . strip_tags($_POST['phone']) . "\r\n" .
'Email: ' . strip_tags($_POST['email']) . "\r\n" .
'Make: ' . strip_tags($_POST['make']) . "\r\n" .
'Model: ' . strip_tags($_POST['model']) . "\r\n" .
'Year: ' . strip_tags($_POST['year']) . "\r\n" .
'Part: ' . strip_tags($_POST['part']) . "\r\n" .
'Paint code: ' . strip_tags($_POST['paintCode']) . "\r\n";
$html = '<html><body>Name: ' . strip_tags($_POST['customerName']) . '<br>' .
'Phone: ' . strip_tags($_POST['phone']) . '<br>' .
'Email: ' . strip_tags($_POST['email']) . '<br>' .
'Make: ' . strip_tags($_POST['make']) . '<br>' .
'Model: ' . strip_tags($_POST['model']) . '<br>' .
'Year: ' . strip_tags($_POST['year']) . '<br>' .
'Part: ' . strip_tags($_POST['part']) . '<br>' .
'Paint code: ' . strip_tags($_POST['paintCode']) . '</body></html>';
$file = '';
if ( 0 < $_FILES['image1']['error'] ) {
//echo 'Error: ' . $_FILES['file1']['error'] . '<br>';
}
else {
$file = 'uploads/' . $_FILES['image1']['name'];
move_uploaded_file($_FILES['image1']['tmp_name'], $file);
}
$file = './' . $file; // attachment
$crlf = "\n";
$mime = new Mail_mime($crlf);
$mime->setTXTBody($text);
//$mime->setHTMLBody($html);
$mime->addAttachment($file, 'image/png');
//do not ever try to call these lines in reverse order
$body = $mime->get();
$headers = array(
'From' => $from,
'To' => $to,
'Subject' => $subject
);
$mime->headers($headers);
When I open mail, I got this:
HOW DO I GET THE ATTACHMENT FILE?
Thanks and best regards.