![Absolute wager](https://loka.nahovitsyn.com/223.jpg)
= "Content-Disposition: attachment".$eol = "Content-Transfer-Encoding: base64".$eol = "Content-Type: application/octet-stream name=\"".$filename."\"".$eol = "Content-Transfer-Encoding: 8bit".$eol.$eol = "Content-Type: multipart/mixed boundary=\"".$separator."\"".$eol // see below The attachment doesn't go in the headers! They should only declare the MIME headers: // main header (multipart mandatory) = "Content-Disposition: attachment".$eol.$eol = "This is a MIME encoded message.".$eol.$eol = "Content-Transfer-Encoding: 7bit".$eol = "Content-Type: multipart/mixed boundary=\"".$separator."\"".$eol.$eol
![sending an email with an pdf attachment using smtp command sending an email with an pdf attachment using smtp command](https://community.dynamics.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/34/8686.Screen.png)
$attachment = chunk_split(base64_encode($pdfdoc)) encode data (puts attachment in proper format)
![sending an email with an pdf attachment using smtp command sending an email with an pdf attachment using smtp command](https://i0.wp.com/blog.webnersolutions.com/wp-content/uploads/2020/06/Openproject-18e.png)
carriage return type (we use a PHP end of line constant) a random hash will be necessary to send mixed content $from = "send email with pdf attachment" $pdf->Cell(40,10, "this is a pdf example") Warning: mail() : SMTP server response: 503 Unexpected command or sequence of commands in C:\AppServ\www\PhpProject1\CV-Generator\testemail2.php on line 55 I can send a text email perfectly but with an attachment I get the following error: I'm trying to send an email using the mail() function in php with a pdf attachment.
![Absolute wager](https://loka.nahovitsyn.com/223.jpg)