This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Sending pdf through pdfcrowd but not opening pdf in rediffmailpro email id account

pankajhkcl wrote on 2016-04-27:
i have created sending pdf attachement to email using your pdfcrowd api. I have to email ids one email go to gmail which is working fine but in rediffpromail email id account not opening pdf file saying error "unable to load pdf".please help me how to open pdf also in rediffpromail.

my code is:

<?php

require 'pdfcrowd.php';

try
{
    // generate a PDF file
    $client = new Pdfcrowd("apiusername", "apiuserkey");
     $pdf = $client->convertURI('new.php');
     //Deal with the email
    $to = 'test@new.com';
    $from = 'test@new.com';
    $subject = 'a PDF file for you';
    $content = 'Please find the file attached';
    $attachment = chunk_split(base64_encode($pdf));
    $filename = "myfile.pdf";
    $boundary =md5(date('r', time()));
    $headers = "From: $from\r\nReply-To: $from";
    $headers .= "\r\nMIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"_1_$boundary\"";
    $message="This is a multi-part message in MIME format.
    
--_1_$boundary
Content-Type: multipart/alternative; boundary=\"_2_$boundary\"
--_2_$boundary
Content-Type: text/plain; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 8bit

$content
--_2_$boundary--
--_1_$boundary
Content-Type: application/pdf; name=\"$filename\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
$attachment
--_1_$boundary--";
    mail($to, $subject, $message, $headers);
}
catch(PdfcrowdException $e)
{
    echo "Pdfcrowd Error: " . $e->getMessage();
}
?>
support wrote on 2016-04-28:
Hello,

Please send us a copy of the PDF gmail attachment to support@pdfcrowd.com and we will look into it.
pankajhkcl wrote on 2016-04-28:
Please check attached zipped files .in this one is pdfcrowd.php file and other one is my source code file pdf.php
support wrote on 2016-04-28:
Thanks for the files. In order to be able to help, we need to see the email. Please forward the email generated by your app to support@pdfcrowd.com