$ Subtitle name & quot; testpdf & quot; $ email & quot; test @ testcom & quot; $ text & quot; hello, the attached file contains the PDF file you need. Click to download. & Lt; br & gt; & lt; ahrefhttp: wwwphpfensicom & gt; ww
- $ Pipeline name = "testpipeline ";
- $ Email = "test@test.com ";
- $ Text = "Hello, the attachment contains the PDF file you need. Click to download.
Www.phpfensi.com "; // text content
- $ Text = base64_encode ($ text); // encode it using base64
- $ Text = chunk_split ($ text); // cut the long string into 76 characters in each line.
- $ Subject = $ subtitle name; // title
- $ From = "admin@phpfensi.com"; // sender
- $ To = $ email; // recipient
- // Attachment
- // Define the demarcation line
- $ Boundary = "nextpart _". uniqid ("");
- $ Boundary2 = "nextpart _". uniqid ("");
- $ Headers = "to: $ torn ";
- $ Headers. = "from: $ fromrn ";
- $ Headers. = "mime-version: 1.0rn ";
- $ Headers. = "content-type: multipart/mixed;
- Boundary = "---- = _ $ boundary" rn ";
- $ Read = file_get_contents ($ External name );
- $ Read = base64_encode ($ read); // encode it using base64
- $ Read = chunk_split ($ read); // cut the long string into 76 characters in each line.
- // Now we can create the subject of the email
- $ Body = "this is a multi-part message in mime format.
- ------ =_$ Boundary
- Content-type: multipart/alternative;
- Boundary = "---- = _ $ boundary2 ";
- ------ =_$ Boundary2
- Content-type: text/html;
- Charset = "gbk"
- Content-transfer-encoding: base64
- $ Text
- ------ = _ $ Boundary2 --
- ------ =_$ Boundary
- Content-type: application/octet-stream;
- Charset = "gbk ";
- Name = "$ Your name"
- Content-disposition: attachment; filename = "$ parameter name"
- Content-transfer-encoding: base64
- $ Read
- ------- = _ $ Boundary --";
- If (mail ($ to, $ subject, $ body, $ headers ))
- Echo "the PDF file (". $ your name. ") you need has been sent to your email:". $ .".
Check. ";
- Else
- Echo "Sorry, failed to send.
";