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();
}
?>