php - Send Mail from raw body for testing purposes -
i developing php application needs retrieve arbitrary emails email server. then, message parsed , stored in database.
of course, have lot of tests task not trivial different mail formats under sun. therefore started "collect" emails clients , different contents.
i have script can send out emails automatically application test mail handling.
therefore, need way send raw emails - structure same come respective client. have emails stored .eml files.
does know how send emails supplying raw body?
edit: more specific: searching way send out multipart emails using source code. example able use (an email plain , html part, html part has 1 inline attachment).
--apple-mail-159-396126150 content-transfer-encoding: quoted-printable content-type: text/plain; plain text email! --=20 =20 =20 --apple-mail-159-396126150 content-type: multipart/related; type="text/html"; boundary=apple-mail-160-396126150 --apple-mail-160-396126150 content-transfer-encoding: quoted-printable content-type: text/html; charset=iso-8859-1 <html><head> <title>daisies</title>=20 </head><body style=3d"background-attachment: initial; background-origin: = initial; background-image: = url(cid:4bff075a-09d1-4118-9ae5-2da8295bdf33/bg_pattern.jpg); = background-position: 50% 0px; "> [ - snip - html email content ] </body></html>= --apple-mail-160-396126150 content-transfer-encoding: base64 content-disposition: inline; filename=bg_pattern.jpg content-type: image/jpg; x-apple-mail-type=stationery; name="bg_pattern.jpg" content-id: <4bff075a-09d1-4118-9ae5-2da8295bdf33/tbg.jpg> /9j/4aaqskzjrgabagaazabkaad/7aarrhvja3kaaqaeaaaasaaa/+ifoeldq19quk9gsuxfaaeb [ - snip - image content ] nu4igsotr47iczxmcmvpypi6xzowkyz/ab42mcad/9k= --apple-mail-159-396126150--
using phpmailer, can set body of message directly:
$mail->body = 'the contents of 1 of .eml files here'
if mails contain mime attachments, not work properly, of mime stuff has go mail's headers. you'd have massage .eml extract particular headers , add them phpmailer mail customheader
Comments
Post a Comment