Как заставить PHP читать MIME сообщения? - Форум успешных вебмастеров - GoFuckBiz.com
 
 
Форум успешных вебмастеров - GoFuckBiz.com

  Форум успешных вебмастеров - GoFuckBiz.com > Бизнес-решения > Скрипты, программы и технические решения
Дата
USD/RUB88.6852
BTC/USD0.0000
Скрипты, программы и технические решения Обсуждаем скрипты, программы и новые технологии.

Закрытая тема
Опции темы Опции просмотра
Старый 11.03.2009, 16:18   #1
klim
Senior Member
 
Аватар для klim
 
Регистрация: 12.01.2009
Сообщений: 531
Бабло: $108200
По умолчанию Как заставить PHP читать MIME сообщения?

Подскажите, пожалуйста, по сабжу. Банальная ситуация - нужно конфёрмить регистрацию на ютюбе, емэилы приходят в MIME формате.
Нагуглил классы, которые корректно обрабатывают заголовки, а мне нужно, чтоб само тело сообщения приобрело читаемый вид.
Вот пример такого мыла:
Код:
Return-path: <[email protected]>
Envelope-to: [email protected]
Delivery-date: Tue, 10 Mar 2009 18:31:08 +0200
Received: from sjl-smtp5.sjl.youtube.com ([64.15.123.233])
	by server.besthostsdot.com with esmtp (Exim 4.69)
	(envelope-from <[email protected]>)
	id 1Lh4rD-0004Mx-9S
	for [email protected]; Tue, 10 Mar 2009 18:31:08 +0200
Received: from sjl-smtp5.sjl.youtube.com (localhost [127.0.0.1])
	by sjl-smtp5.sjl.youtube.com (Postfix) with ESMTP id 52314504980
	for <[email protected]>; Tue, 10 Mar 2009 09:31:06 -0700 (PDT)
DomainKey-Signature: a=rsa-sha1; b=sXQ69TYYfiZOb3igGPKxiraX+VUHOweEsy4hIWQmmdi/tApgQi/Zgv6Sy/V2qhwGM1D2D+XDIIa0ew0rVjsO4Vf3Ce8d/HmFLhjBQN9VtkZjWwHrCtMwxDwvE3wf2YxWLhREyXAfCAAHsowTi4aN4rPQX3cp28I55WmdqT5Z2TY=; c=nofws; d=youtube.com; q=dns; s=selector1
Received: from youtube.com (sjl-web408.sjl.youtube.com [10.33.46.33])
	by sjl-smtp5.sjl.youtube.com (Postfix) with ESMTP id 4DB29504921
	for <[email protected]>; Tue, 10 Mar 2009 09:31:06 -0700 (PDT)
Received: from sjl-web408.sjl.youtube.com (localhost [IPv6:::1])
	by youtube.com (Postfix) with ESMTP id 41A7FA3A6A
	for <[email protected]>; Tue, 10 Mar 2009 09:31:06 -0700 (PDT)
Content-Type: multipart/alternative; boundary="===============0843990960=="
MIME-Version: 1.0
Subject: =?iso-8859-1?q?Welcome_to_YouTube?=
From: YouTube Service <[email protected]>
To: NewUser43223 <[email protected]>
Message-Id: <[email protected]>
Date: Tue, 10 Mar 2009 09:31:06 -0700 (PDT)

--===============0843990960==
Content-Type: text/plain; charset="iso-8859-1"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Click here - http://www.youtube.com/confirm_email?cid=3D4105ACB29BF736AE&ni=
d=3DIYKmgwz-jSozdxOYbO-I8dJba_X1oUG5pcjvRdU1NI8WuQjcvLlJqw=3D=3D&next=3D/in=
dex
or copy it into your browser to confirm
your email address and start uploading and =

commenting on videos immediately!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Thanks for Signing Up, NewUser43223!

You've taken the next step in becoming part of the YouTube community. Now t=
hat you're a member, you can rate videos, but to leave comments or upload y=
our own videos to the site, you'll need to confirm your email using this li=
nk - http://www.youtube.com/confirm_email?cid=3D4105ACB29BF736AE&nid=3DIYKm=
gwz-jSozdxOYbO-I8dJba_X1oUG5pcjvRdU1NI8WuQjcvLlJqw=3D=3D&next=3D/index. Ple=
ase read the Terms of Use and Copyright Tips before uploading so that you u=
nderstand what's allowed on the site.

To get you started, here are some of the fun things you can do with YouTube:

	* Upload and share your videos worldwide
	* Browse millions of original videos uploaded by community members
	* Find, join, and create video groups to connect with people who have simi=
lar interests
	* Customize your experience with playlists and subscriptions
	* Integrate YouTube with your website using video embeds or APIs

There's a lot more to explore, and more features are always in the works. T=
hanks for signing up, and we hope you enjoy the site!

- The YouTube Team


++ Links ++
Terms of Use:    http://www.youtube.com/t/terms
Copyright Tips:  http://www.youtube.com/t/howto_copyright
Browse Videos:   http://www.youtube.com/browse
Video Upload:    http://www.youtube.com/my_videos_upload
APIs:            http://www.youtube.com/dev

You are receiving this email because a YouTube user created an account with=
 this email address. If you are the owner of this email address and did not=
 create the YouTube account, just ignore this message and the account will =
remain inactive.


--===============0843990960==
Content-Type: text/html; charset="iso-8859-1"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

		<html lang=3D"en">

	<head>
		<title>Welcome to YouTube</title>
	</head>


	<body style=3D"background-color: #FFF; margin: 20px; padding: 0px;">
		<table width=3D"100%" cellspacing=3D"0" cellpadding=3D"0" border=3D"0">

			<tr valign=3D"center">
				<td align=3D"left" width=3D"180">
					<a href=3D"http://www.youtube.com/">
						<img border=3D"0" alt=3D"YouTube" width=3D"175" height=3D"33" src=3D"=
http://s.ytimg.com/yt/img/logo_tagline_small.gif">
					</a>		=

				</td>
				<td align=3D"right">
					<a href=3D"http://help.youtube.com/support/youtube/">help center</a>
					| <a href=3D"http://www.youtube.com/account#notifications/events">e-ma=
il options</a>
						| <a href=3D"http://www.youtube.com/email_spam?v=3D1a&c=3D_33EiDplMck=
muBkp8i7mZbjIdt7Vm5Jexi2HG9QOPB1BmSkIsuODXzp6aGl0hqQW8kvNqUckeTuHs426uywaZz=
rHpI4Hwyy3SelEssAp5l2zXajZHXYpNJ-ao_4XIpWQSvfL2jeyBqxsCIRtZoW688OsNScgcc0zA=
qMFJeX_LB4EPEA5ov7IwA=3D=3D">report spam</a>
				</td>
			</tr>

			<tr>
				<td colspan=3D"2" style=3D"padding: 10px 0px 0px 0px;">


<h3><a href=3D"http://www.youtube.com/confirm_email?cid=3D4105ACB29BF736AE&=
nid=3DIYKmgwz-jSozdxOYbO-I8dJba_X1oUG5pcjvRdU1NI8WuQjcvLlJqw=3D=3D&next=3D/=
index">Confirm your email address</a> to start participating in the YouTube=
 community!</h3>
<br>
<br>
<h2>Thank You for Signing Up, NewUser43223!</h2>

<p>You've taken the next step in becoming part of the YouTube community. No=
w that you're a member, you can rate videos, but to leave comments or uploa=
d your own videos to the site, you'll first need to <a href=3D"http://www.y=
outube.com/confirm_email?cid=3D4105ACB29BF736AE&nid=3DIYKmgwz-jSozdxOYbO-I8=
dJba_X1oUG5pcjvRdU1NI8WuQjcvLlJqw=3D=3D&next=3D/index">confirm your email a=
ddress</a>. If that link doesn't appear, you can paste the following link i=
nto your browser:<br><br>
http://www.youtube.com/confirm_email?cid=3D4105ACB29BF736AE&nid=3DIYKmgwz-j=
SozdxOYbO-I8dJba_X1oUG5pcjvRdU1NI8WuQjcvLlJqw=3D=3D&next=3D/index <br><br>
Please read <a href=3D"http://www.youtube.com/t/terms">Terms of Use</a> and=
 <a href=3D"http://www.youtube.com/t/howto_copyright">Copyright Tips</a> be=
fore uploading so that you understand what's allowed on the site.</p>

<p>To get you started, here are some of the fun things you can do with YouT=
ube:</p>

<ul>
	<li><a href=3D"http://www.youtube.com/my_videos_upload">Upload</a> and sha=
re your videos worldwide</li>
	<li><a href=3D"http://www.youtube.com/browse">Browse</a> millions of origi=
nal videos uploaded by community members</li>
	<li>Find, join and create video groups to connect with people who have sim=
ilar interests</li>
	<li>Customize your experience with playlists and subscriptions</li>
	<li>Integrate YouTube with your website using video embeds or <a href=3D"h=
ttp://www.youtube.com/dev">APIs</a></li>
</ul>


<p>There's a lot more to explore, and more features are always in the works=
. Thanks for signing up, and we hope you enjoy the site!</p>

<p>- The YouTube Team
</p>

<p style=3D"font-size: 11px; color: #333;">You are receiving this email bec=
ause a YouTube user created an account with this email address. If you are =
the owner of this email address and did not create the YouTube account, jus=
t ignore this message and the account will remain inactive.</p>

				</td>
			</tr>

			<tr>
				<td colspan=3D"2" align=3D"center" style=3D"padding-top: 50px; color: #=
ccc;">
					&copy; 2009 YouTube, LLC
				</td>
			</tr>

		</table>
	</body>
	</html>

--===============0843990960==--
klim вне форума  
Старый 11.03.2009, 16:42   #2
zlaya ssuka
ChefJavaProgrammierer
 
Аватар для zlaya ssuka
 
Регистрация: 05.04.2007
Сообщений: 1,165
Бабло: $15090
Отправить сообщение для zlaya ssuka с помощью ICQ
По умолчанию

Цитата:
Сообщение от klim Посмотреть сообщение
Подскажите, пожалуйста, по сабжу. Банальная ситуация - нужно конфёрмить регистрацию на ютюбе, емэилы приходят в MIME формате.
Нагуглил классы, которые корректно обрабатывают заголовки, а мне нужно, чтоб само тело сообщения приобрело читаемый вид.
Вот пример такого мыла:
[/CODE]
Миме формат не причем, а причем здесь - мультипарт, его разбирает например пхп функция "imap_fetchstructure", но она для имапа, как ее приколхозить для строки или поп мэйла я не знаю, но думаю есть много других решений.
zlaya ssuka вне форума  
Старый 11.03.2009, 19:38   #3
klim
Senior Member
 
Аватар для klim
 
Регистрация: 12.01.2009
Сообщений: 531
Бабло: $108200
ТС -->
автор темы ТС По умолчанию

2 zlaya ssuka:
Спасибо про подсказку про мультипарт.
Сначала выдёргиваешь нужный кусок сообщения с помощью imap_fetchbody.
Потом imap_qprint, если "Content-Transfer-Encoding: quoted-printable".
Сообщение становится читаемым.
klim вне форума  
Старый 11.03.2009, 23:24   #4
Bananz
Техноманьяк
 
Регистрация: 12.02.2009
Сообщений: 118
Бабло: $6200
Отправить сообщение для Bananz с помощью ICQ
По умолчанию

есть ещё Zend Framework и Zend_Mail из него
Я такую задачу решал через него как-то
Bananz вне форума