Nieuwsbrief pdf wordt .dat op mac

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Marco van den Haak

Marco van den Haak

07/02/2011 20:26:38
Quote Anchor link
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)
PHP script in nieuw venster Selecteer het PHP script
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
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";
    }
Gewijzigd op 07/02/2011 21:16:55 door Marco van den Haak
 
PHP hulp

PHP hulp

04/05/2024 04:01:43
 
Jelmer -

Jelmer -

07/02/2011 22:44:45
Quote Anchor link
Als ik de broncode van een werkend pdf attachment bekijk in Mail.app, valt me deze op:
Jij hebt
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
Content-Type: application/octet-stream;

Mijn mailtje heeft:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
Content-Type: application/pdf;

Zou dat ermee te maken kunnen hebben?

Even voor de volledigheid, ongeveer het mailtje:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
From: iemand <[email protected]>
Subject: tentamen
To: Jelmer <[email protected]>
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--
 
Marco van den Haak

Marco van den Haak

08/02/2011 08:26:47
Quote Anchor link
Dank je wel ik heb het probleem met jou tip opgelost.
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.