postmark-php icon indicating copy to clipboard operation
postmark-php copied to clipboard

local.ERROR: Critical Error : base64_encode() expects parameter 1 to be string, object given

Open hiren004 opened this issue 6 years ago • 0 comments

I've installed this package with Lumen and try to send an email with pdf attachment.

I've used barryvdh to generate pdf and try to use it as below:

$templateData = [
                 'customer_name'       => $transactionInvoiceData->customer_name ? $transactionInvoiceData->customer_name : 'NA',
                 'order_id'            => $transactionInvoiceData->order_id,
                 'paykun_payment_id'   => $transactionInvoiceData->req_id,
                ];
$from = config('postmark.verification_email_from');
$subject = 'Transaction Details Invoice';
$htmlBody = 'Hello '.$transactionInvoiceData->customer_name. ', <br/><br/> Please check attached invoice pdf for your Translation Order. <br/><br/> Thanks,';
$attachPDF = PDF::loadView('emails.transaction_invoice', $templateData)->output();
$attachment = PostmarkAttachment::fromRawData($attachPDF , "transaction_invoice.pdf", "application/pdf");
$sendEmail = $client->sendEmail($from, $email_id, $htmlBody, NULL, true, NULL, NULL, NULL, NULL, [$attachPDF]);

But it gives me error like:

local.ERROR: Critical Error : base64_encode() expects parameter 1 to be string, object given

If i remove $attachment then its send an mail without attachment, but not working for attachment!

Any help will be appreciated! Thanks.

hiren004 avatar Dec 04 '18 10:12 hiren004