Hi
I have this piece of PHP code that takes data from Flash and then sends an email with an image attachment using SwiftMailer.
<?ph
prequire_once 'lib/swift_required.php';
$image = $_GET['pic'];
$sendto = $_GET['to'];
$sendarray = explode(' ',$sendto);
$attachment = Swift_Attachment::newInstance($image, 'submission.jpg', 'image/jpg');
$message = Swift_Message::newInstance();
$message->setSubject('Do you hear me now');
$message->setFrom(array('donotreply@mydomain.com'));
$message->setBody("Here is your picture!");
for($i=0;$i<count($sendarray);$i++){
$message->addTo($sendarray[$i]);
}
$message->attach($attachment);
$transport = Swift_SendmailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport);
$mailer->send($message);
?>
I’ve tested it and everything works EXCEPT the image attachment part. I’m sure that $image needs to be in binary, but I do not know how. When I send it from Flash, it is a ByteArray, but I still need to convert to binary in PHP. Can someone help?
Thanks in advance.