Foros del Web » Programando para Internet » PHP »

Extraer datos de Email

Estas en el tema de Extraer datos de Email en el foro de PHP en Foros del Web. Al recibir un email en mi servidor se activa un PIPE.php, el cual almacena en mySQL el Email recibido. Hasta aquí todo trabaja perfecto. deseo ...
  #1 (permalink)  
Antiguo 12/07/2015, 05:27
 
Fecha de Ingreso: enero-2002
Mensajes: 1.174
Antigüedad: 22 años, 3 meses
Puntos: 21
Extraer datos de Email

Al recibir un email en mi servidor se activa un PIPE.php, el cual almacena en mySQL el Email recibido. Hasta aquí todo trabaja perfecto.

deseo extraer el ASUNTO y el CONTENIDO DEL MENSAJE. ¿Alguna idea de como hacerlo?

Esto es lo que recibo de YAHOO, y si proviene de HOTMAIL viene un poco diferente.


From [email protected] Sun Jul 12 06:06:59 2015
Received: from nm31-vm4.bullet.mail.gq1.yahoo.com ([98.136.216.211]:37633)
by ns1.dominio.com with esmtps (TLSv1:RC4-SHA:128)
(Exim 4.85)
(envelope-from <[email protected]>)
id 1ZEF62-0006Sn-SF
for [email protected]; Sun, 12 Jul 2015 06:06:59 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1436699217; bh=rneWDMc9H1lQdPX6vLoTozqigywDJMJrvHt81ETtIgQ=; h=Date:From:Reply-To:To:Subject:From:Subject; b=iQbJE6RYWqHet09WIhunH1fiINbJL9GdTKXvjOWOYKR7JzPO FfLgQqJjj3MeTvyRm+bZSt5oPqiQb6GBfwYVgeO9Iu81aRzb7l bOcIbsIGibvNeUZafqD9mRV52V2qKZ91CwBbivH33J5D9as1qe w4Q0aKhVg52zPBE0qhOgthQPDXROHz2cPdCXeVPoWg0rjx8naW 0gD3cDrarHAoUx096QCbVFHvAN4guICv582GkHlsegceSXmge/RzWXYepmqFsGW7jSsg9Q2BEAaF51qZby5Rz/3vVHVT5ZAOb2GHKVsnqExjGiIXJwgFyR5HG2jFUbxkZ6L9VJ5h NWw2HMgw==
Received: from [127.0.0.1] by nm31.bullet.mail.gq1.yahoo.com with NNFMP; 12 Jul 2015 11:06:57 -0000
Received: from [216.39.60.182] by nm31.bullet.mail.gq1.yahoo.com with NNFMP; 12 Jul 2015 11:04:13 -0000
Received: from [66.196.81.172] by tm18.bullet.mail.gq1.yahoo.com with NNFMP; 12 Jul 2015 11:04:13 -0000
Received: from [98.139.212.192] by tm18.bullet.mail.bf1.yahoo.com with NNFMP; 12 Jul 2015 11:04:13 -0000
Received: from [127.0.0.1] by omp1001.mail.bf1.yahoo.com with NNFMP; 12 Jul 2015 11:04:13 -0000
X-Yahoo-Newman-Property: ymail-4
X-Yahoo-Newman-Id: [email protected]
X-YMail-OSG: OJK3yNsVM1kgaXjafYcOjoVZnj8wiYSt4nOCobwdHJ4XRfB9uL PTY4iSVdpovWj
ebDjhoeHyGIDYWFl49iShUmKYF4dkuX8Fd9rV8qqgk9gDTCd9y nCtUfjFIRjoyPTsqREB9BAmYea
tW_DX9KfJbFT2DWBF0EaxIli8.Wcw27wuIBMXPiDJU_PGvLCVF SvtBloIbm2VLX2kdTT5pW2grGC
f5tWOq2NfaC1QY0oTUc4vzKbfdqW.W8dsjg4605JVLd7jwqrNX uFyaPDHM9zVGRJzewGDaFAZims
mhtzvOTq5AKoMcmYJ2M1F1FsWh5wu1Cv9WX3_XMz2fx_trJM0C iQksHF0pT9YaVesGEUeEI2CFDP
MntGTQaApy5_Ye3ks3eWGo0v3wDiIxoQwzOXiz7ko1JrPMsphX QGn4qmODd7WsJL1Gg0i6Y.zoW3
l.AEkgT2ORc4gSUnTHBCdyZhY36qqxP_FD7XpkqwYB3yJo.rCA J47UVTxgjLatx0MlrFFRrsAd4K
iOMW71XlMP1i9EFb9hF6C
Received: by 66.196.80.193; Sun, 12 Jul 2015 11:04:12 +0000
Date: Sun, 12 Jul 2015 11:04:11 +0000 (UTC)
From: Paulina Paulina <[email protected]>
Reply-To: Paulina Villarreal <[email protected]>
To: "[email protected]" <[email protected]>
Message-ID: <1813136997.686282.1436699051322.JavaMail.yahoo@ma il.yahoo.com>
Subject: DESDE YAHOO
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_686281_1240220457.1436699051321"
Content-Length: 582

------=_Part_686281_1240220457.1436699051321
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

este es el cuerpo del mensaje
------=_Part_686281_1240220457.1436699051321
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1436699020053_2310" dir="ltr">este es el cuerpo del mensaje</div></div></body></html>
------=_Part_686281_1240220457.1436699051321--
  #2 (permalink)  
Antiguo 12/07/2015, 21:21
Avatar de enlinea777  
Fecha de Ingreso: mayo-2008
Ubicación: frente al pc
Mensajes: 1.830
Antigüedad: 15 años, 11 meses
Puntos: 127
Respuesta: Extraer datos de Email

Usa las cabeceras
Subject: para el sujeto y Content-Type: para el contenido.

mas informacion en los textos del standard para internet.
alli podras encontrar todo lo que necesites para extraer lo que quieras

https://tools.ietf.org/html/rfc821

SI, todos los protocolos de transferencia tienen un standard
si quieres invertigar algo
usa rfc en las busquedas de google.
por ejemplo el formato xml
rfc xml

Etiquetas: email, html, mysql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:03.