Hi there I hope someone can help...
I'm building a site so that I can send pics from my mobile phone or email to an email address and this then takes the subject and attachment and adds to database.
So far 90% of images I send get uploaded and properly displayed.. however the odd random image gets chopped short a little.
I've got my email alias being parsed by a php script so anything sent to photos@mydomain gets uploaded to database...
The way I extract the image from email is:
for ($i=0; $i < count($lines); $i++)
{
// this is a header
$headers .= $lines[$i]."\n";
if (preg_match("/$subject(.*)/", $lines[$i], $matches))
{
$subject = $matches[0];
//print_r($matches);
}
if (preg_match("/^Content-Type: (.*)/", $lines[$i], $matches))
{
$aType = $matches[1];
}
if (preg_match("/^[A-Za-z0-9+\\/]+$/", $lines[$i], $matches))
{
$content = $content.$matches[0]."\n";
}
}
From above I grab the Subject, Content-Type and the attachment...
Can anyone suggest a better way of doing this?? Can the above "/[A-Za-z0-9+\/]+$/" be improved to make sure that all mime encoded attachments are extracted..?????
Any help would be a great help!