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.
Trending News
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
- ChrisLv 74 years ago
I'd go this route: https://stackoverflow.com/questions/12301358/send-...
Quote: "If you do it with PHP's mail() function, you'll be writing stacks of code, and you'll probably have lots of really difficult to find bugs."