There is lots here to try to digest but the following line looks wrong.
$header = "From: ".$from_name." <usman_86@rocketmail.com>".$from_mail. $eol;
When resolved, this would appear as:
"From: my_reply_to@flowsleeve.com <usman_86@rocketmail.com>Find Dealer @ flowsleeve\r\n"
The reply-to address is also wrong, see the full printout of the header to see what I mean.
Tip: To make it easier I'd suggest using variables that are named the
same as the parameters supplied to the function mail_attachment
~ I
keep having to count which parameter refers to which variable.
The entire header appears like this:
From: my_reply_to@flowsleeve.com <usman_86@rocketmail.com>Find Dealer @ flowsleeve
Reply-To: Find Dealer @ flowsleeve
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="2642aff44ba290c53e0574e15444e12f"
Content-Transfer-Encoding: 7bit
--2642aff44ba290c53e0574e15444e12f
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
--2642aff44ba290c53e0574e15444e12f
Content-Type: application/octet-stream; name="pdf.pdf
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="pdf.pdf
--2642aff44ba290c53e0574e15444e12f--
From previous experience of dealing with attachments the formatting is critical - it MUST be exactly right in terms of line endings or it will fail.
Some pointers that might help:
- There should be only one new line before a boundary.
- There should be 2 dashes only after the last boundary.
- There are 2 places where Content-Transfer-Encoding needs to have a new line before.
Also, I forgot to mention that you call the function mail_attachment
with 7 parameters yet the function takes 8 parameters. The one that appears to not be supplied in the function call is $from_mail