Nieuwsbrief pdf wordt .dat op mac
Ik heb een nieuwsbrief in PHP, het versturen gaat prima. Nu heb ik het ook voor elkaar dat je een bijlage kan meesturen. Werkt overal Outlook, Hotmail, Gmail enz. Alleen nu blijkt dat op de MAC mijn .pdf een .dat wordt. Doe ik iets fout, is dit een bekend Mac probleem? of zit er een fout in mijn script?
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
if (isset ($_POST['opslaan'])) {
if ($_FILES['file']['size'] < 1024 * $bijlage_size) {
include ('../newsletter/template.php');
//$headers = "From: $company <$email>\n";
//$headers = "Reply-to: $email\n";
$headers = "Return-Path: $bounce\n";
$headers .= "X-Sender: $company <$email>\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "X-Priority: 3\n";
if (!empty ($_FILES['file']['name'])) {
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"" . bound . "\"\r\n";
$headers .= "Content-Disposition: attachment\r\n";
$fp = fopen($_FILES['file']['tmp_name'], 'r');
$bestand = fread($fp, $_FILES['file']['size']);
fclose($fp);
$body = "This is a multi-part message in MIME format.\r\n";
$body .= "\r\n";
$body .= "--" . bound . "\r\n";
$body .= "Content-Type: text/html; charset=iso-8859-1\r\n";
$body .= "Content-Transfer-Encoding: 7bit\r\n";
$body .= "\r\n";
//het bericht
$body .= $output . "\r\n";
$body .= "--" . bound . "\r\n";
$body .= "Content-Type: application/octet-stream; name=" . $_FILES['file']['name'] . "\r\n";
$body .= "Content-Transfer-Encoding: base64\r\n";
$body .= "Content-disposition: attachment\r\n";
$body .= "\n";
$body .= chunk_split(base64_encode($bestand)) . "\r\n";
}
else {
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "MIME-Version: 1.0\n";
}
if ($_FILES['file']['size'] < 1024 * $bijlage_size) {
include ('../newsletter/template.php');
//$headers = "From: $company <$email>\n";
//$headers = "Reply-to: $email\n";
$headers = "Return-Path: $bounce\n";
$headers .= "X-Sender: $company <$email>\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "X-Priority: 3\n";
if (!empty ($_FILES['file']['name'])) {
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"" . bound . "\"\r\n";
$headers .= "Content-Disposition: attachment\r\n";
$fp = fopen($_FILES['file']['tmp_name'], 'r');
$bestand = fread($fp, $_FILES['file']['size']);
fclose($fp);
$body = "This is a multi-part message in MIME format.\r\n";
$body .= "\r\n";
$body .= "--" . bound . "\r\n";
$body .= "Content-Type: text/html; charset=iso-8859-1\r\n";
$body .= "Content-Transfer-Encoding: 7bit\r\n";
$body .= "\r\n";
//het bericht
$body .= $output . "\r\n";
$body .= "--" . bound . "\r\n";
$body .= "Content-Type: application/octet-stream; name=" . $_FILES['file']['name'] . "\r\n";
$body .= "Content-Transfer-Encoding: base64\r\n";
$body .= "Content-disposition: attachment\r\n";
$body .= "\n";
$body .= chunk_split(base64_encode($bestand)) . "\r\n";
}
else {
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "MIME-Version: 1.0\n";
}
Gewijzigd op 07/02/2011 21:16:55 door Marco van den Haak
Gesponsorde koppelingen:
Als ik de broncode van een werkend pdf attachment bekijk in Mail.app, valt me deze op:
Jij hebt
Mijn mailtje heeft:
Zou dat ermee te maken kunnen hebben?
Even voor de volledigheid, ongeveer het mailtje:
Jij hebt
Mijn mailtje heeft:
Zou dat ermee te maken kunnen hebben?
Even voor de volledigheid, ongeveer het mailtje:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From: iemand <iemand@gmail.com>
Subject: tentamen
To: Jelmer <jelmer@bestaattochniet.nl>
Content-type: multipart/mixed; boundary=Apple-Mail-5--270744998
--Apple-Mail-5--270744998
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Jelmer,
Bla bla bla…
-Iemand
--Apple-Mail-5--270744998
Content-Disposition: inline;
filename=Exam.pdf
Content-Type: application/pdf;
x-mac-hide-extension=yes;
x-unix-mode=0644;
name="Exam.pdf"
Content-Transfer-Encoding: base64
JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRmlsdGVyIC9G
bGF0ZURlY29kZSA+PgpzdHJlY…
--Apple-Mail-5--270744998--
Subject: tentamen
To: Jelmer <jelmer@bestaattochniet.nl>
Content-type: multipart/mixed; boundary=Apple-Mail-5--270744998
--Apple-Mail-5--270744998
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Jelmer,
Bla bla bla…
-Iemand
--Apple-Mail-5--270744998
Content-Disposition: inline;
filename=Exam.pdf
Content-Type: application/pdf;
x-mac-hide-extension=yes;
x-unix-mode=0644;
name="Exam.pdf"
Content-Transfer-Encoding: base64
JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRmlsdGVyIC9G
bGF0ZURlY29kZSA+PgpzdHJlY…
--Apple-Mail-5--270744998--
Dank je wel ik heb het probleem met jou tip opgelost.



