PHP Mail Headers

前端 未结 4 541
情歌与酒
情歌与酒 2021-01-16 00:15

Essentially what I\'m trying to do is attach a file to an email I\'m sending out. Simple enough, right? For some reason or another it does not like the following code (presu

4条回答
  •  被撕碎了的回忆
    2021-01-16 01:01

    If you insist on building your own header, I would suggest doing so with the aid of your output buffer - also I noticed that you were failing to close up your content boundaries. Pasted below is how I would edit the header generating part of your script.

    ob_start();
    
    ?>
    MIME-Version: 1.0
    From: noreply@x.com
    Reply-To: noreply@x.com
    Content-Type: multipart/mixed; boundary=""
    
    This is a multi-part message in MIME format.
    --
    Content-Type:text/plain; charset=iso-8859-1
    Content-Transfer-Encoding: 7bit
    
    
    
    ----
    --
    Content-Type: text/csv; name=""
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment; filename=""
    
    
    
    ----
    

提交回复
热议问题