$to = $line['epost'] . "\r\n" . 'order@hallstromsplat.com'; Taget från manualen, redigera med dina uppgifter och testa.bifoga fil med denna kod?
$subject = "Bekräftelse på din beställning...";
$msg = "Klicka på länken här så kan Ni printa ut er beställning.\n\n test";
$headers = 'From: order@hallstromsplat.com' . "\r\n" .
'Reply-To: order@hallstromsplat.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $msg, $headers);
Sv: bifoga fil med denna kod?
http://se.php.net/manual/en/ref.mail.phpHow to add multiple attachment to an email:
An email can be split into many parts separated by a boundary followed by a Content-Type and a Content-Disposition.
The boundary is initialized as follows:
<?php
$boundary = '-----=' . md5( uniqid ( rand() ) );
?>
You can attach a Word document if you specify:
<?php
$message .= "Content-Type: application/msword; name=\"my attachment\"\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "Content-Disposition: attachment; filename=\"$theFile\"\n\n";
?>
When adding a file you must open it and read it with fopen and add the content to the message:
<?php
$path = "whatever the path to the file is";
$fp = fopen($path, 'r');
do //we loop until there is no data left
{
$data = fread($fp, 8192);
if (strlen($data) == 0) break;
$content .= $data;
} while (true);
$content_encode = chunk_split(base64_encode($content));
$message .= $content_encode . "\n";
$message .= "--" . $boundary . "\n";
?>
Add the needed headers and send!
<?php
$headers = "From: \"Me\"<me@here.com>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";
mail('myAddress@hotmail.com', 'Email with attachment from PHP', $message, $headers);
?>
Finally, if you add an image and want it displayed in your email, change the Content-Type from attachment to inline:
<?php
$message .= "Content-Disposition: inline; filename=\"$theFile\"\n\n";
?>
Enjoy!