Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Sending a modified image through email in php?

I am working on a script that opens an existing image of a form, and fills in the form. I have typed all of the code necessary to write the text in the form. The problem is that I am trying to send the modified image to email. I am using the GD library ImageCreate, ImageCopy and ImageJPEG. But instead of saving an image, the form is to be emailed. here's what I got so far

(code)

$tempname = "forms/temp".mt_rand().".jpg";

$str = imagejpeg($image, $tempname);

$datamsg = chunk_split(base64_encode(file_get_contents($tempname)));

$uid = md5(uniqid(time()));

$message = "Please see attachment for your form";

$emailheader = "From: email@address.com\r\n";

$emailheader .= "Reply-To: email@address.com \r\n";

$emailheader .= "MIME-Version: 1.0\r\n";

$emailheader .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n";

$emailheader .= "This is a multipart message in Mime-Format\r\n";

$emailheader .= "--" .$uid."\r\n";

$emailheader .= "Content-Type: text/plain;\r\n";

$emailheader .= "Content-Transfer-Encoding: 7bit\r\n";

$emailheader .= $message ."\r\n";

$emailheader .= "--" .$uid."\r\n";

$emailheader .= "Content-Type: Image/JPEG;name=\"jtstemp.jpg\"\r\n";

$emailheader .= "Content-Transfer-Encoding: base64\r\n";

$emailheader .= "Content-Disposition: attachment; Filename=\"jtstemp.jpg\"\r\n";

$emailheader .= $datamsg."\r\n";

(end code)

1 Answer

Relevance
Still have questions? Get your answers by asking now.