Answer the question
In order to leave comments, you need to log in
What should be the text of an email with an attachment via SMTP in PHP?
Добрый день!
Используется SMTP Yandex с SSL, порт 465. Отправляется письмо, не используя сторонние библиотеки... Только fsockopen и т.д.... Но вопрос не в способе или технике отправки, а в самом письме. Удается отправить письмо в HTML, но не получается вложить файл...
Так все отправляет:
Date: Tue, 12 Jan 2016 8:19:08 +0000
From: =?utf-8?Q?NameFrom?= <[email protected]>
X-Mailer: The Bat! (v3.99.3) Professional
Reply-To: =?utf-8?Q?NameFrom?= <[email protected]>
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
To: =?utf-8?Q?NameTo?= <[email protected]>
Subject: =?utf-8?Q?SUBJECT?=
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit
Текст письма
.
Date: Tue, 12 Jan 2016 8:19:08 +0000
From: =?utf-8?Q?NameFrom?= <[email protected]>
X-Mailer: The Bat! (v3.99.3) Professional
Reply-To: =?utf-8?Q?NameFrom?= <[email protected]>
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
To: =?utf-8?Q?NameTo?= <[email protected]>
Subject: =?utf-8?Q?SUBJECT?=
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------A4DE0016483BC21"
----------A4DE0016483BC21
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit
Текст письма
----------A4DE0016483BC21
Content-Type: application/octet-stream; name="0.txt"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0.txt"
0KTQsNC50LvQuNC6INGC0LXQutGB0YLQvtCy0YvQuS4g0J7QtNC90LAg0YjRgtGD0LrQsCE=
----------A4DE0016483BC21
.
Answer the question
In order to leave comments, you need to log in
Вы неправильно используете boundary, надо добавлять -- перед boundary у открывающего и промежуточных разделителей и -- после баундари после закрывающего разделителя, т.е. если boundary XX то разделители --XX и закрывающая граница --XX--, в вашем случае должно быть
Date: Tue, 12 Jan 2016 8:19:08 +0000
From: =?utf-8?Q?NameFrom?= <[email protected]>
X-Mailer: The Bat! (v3.99.3) Professional
Reply-To: =?utf-8?Q?NameFrom?= <[email protected]>
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
To: =?utf-8?Q?NameTo?= <[email protected]>
Subject: =?utf-8?Q?SUBJECT?=
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------A4DE0016483BC21"
------------A4DE0016483BC21
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit
Текст письма
------------A4DE0016483BC21
Content-Type: application/octet-stream; name="0.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="0.txt"
0KTQsNC50LvQuNC6INGC0LXQutGB0YLQvtCy0YvQuS4g0J7QtNC90LAg0YjRgtGD0LrQsCE=
------------A4DE0016483BC21--
.
https://github.com/PHPMailer/PHPMailer/blob/master...
посмотри здесь
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question