PHP mail() attachment is corrupt

后端 未结 3 1566
Happy的楠姐
Happy的楠姐 2021-01-25 16:00

I have been struggling with trying to send an email with an attachment using PHP. It used to work but the message body was scrambled. Now I have got the message body to work but

3条回答
  •  情歌与酒
    2021-01-25 16:49

    I know you've said about pre-built classes but there is a reason that people do this - why re-invent the wheel? I use SwiftMailer for projects - it couldn't be simpler. See this SwiftMailer example for 13 lines (including some blank ones) of how to create a message, add an attachment and send.

    As to the resolution of your actual query, upvote to Josh's answer - I'd second changing the encoding and seeing how you get on. Have you tried getting an example email message which has an attachment that works, and examining the raw data?

提交回复
热议问题