A
A
Andrew2014-02-03 07:25:04
PHP
Andrew, 2014-02-03 07:25:04

Why does the text disappear somewhere when sending a letter via PHP with three attachments and text?

I'm trying to send an email with text and three attachments via sockets. However, only attachments come in, the text is ignored. here is the body of the letter:

Subject: =?utf-8?Q?some_encoded_nice subject
From: =?utf8?Q?Sender name encoded?= <[email protected]>
X-Mailer: FR-konsalt WEB mailer
To: =?utf8?Q?= <[email protected]>
MIME-Version: 1.0
Content-type: multipart/mixed; boundary="frkonsaltboundary"
--frkonsaltboundary
Content-type: text/html; charset="utf8"
Content-Transfer-Encoding: base64

some text encoded by base64

--frkonsaltboundary
Content-Type: application/vnd.openxmlformats-officedocument.presentationml.presentation; name="Наша презентация.pptx"
Content-Transfer-Encoding:base64
Content-Disposition:attachment

file encoded by base64
--frkonsaltboundary
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document; name="Официальное положение.docx"
Content-Transfer-Encoding:base64
Content-Disposition:attachment

file encoded by base64
--frkonsaltboundary
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document; name="Список документов.docx"
Content-Transfer-Encoding:base64
Content-Disposition:attachment

file encoded by base64
frkonsaltboundary--

There are other letters there, which are only with text - they are normal. I suspect I messed up with the headers, but I can't figure out where.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey, 2014-02-03
@SkaN2412

The solution turned out to be that before the first boundary it was necessary to put an empty string

I
Igor Yatsevich, 2014-02-03
@IgoNsk

Why not use some ready-made component for sending mail? like SwiftMailer from Symfony 2.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question