Sending pictures by e-mail to a Drupal site
Dan successfully did this with the mailhandler and mailsave modules.
He'll have to post how. Here's some utterly irrelevant and useless background:
Images with mailhandler... back in 2003!
http://drupal.org/node/2702
I successfully implemented imagehandler.module for Drupal 4.0. Since mailhandler and image module has changed a lot since, you probably need retune the function. It currently supports only JPG.
function imagehandler_mailhandler($node, $stream, $msg_number, $mailbox) {
$image = mailhandler_get_part($stream, $msg_number, "IMAGE/JPEG");
if ($image) {
$node->type = "image";
$node->format = "jpg";
$node->body = mailhandler_get_part($stream, $msg_number, "TEXT/PLAIN");
$node->image_id = md5(rand());
$node->image_name = $node->title.".jpg";
$node->thumb_name = _image_thumbname($node);$dest = fopen(_image_tempname($node),"w");
fputs($dest,$image,strlen($image));
fclose($dest);watchdog("message", "Retreived image $node->image_name from incoming mail");
}
return $node;
}
Also old, but not as old:
mailsave module for drupal
http://www.stuartandnicola.com/node/433
mailhandler images names
Dan successfully did this with the mailhandler and mailsave modules.
He'll have to post how. Here's some utterly irrelevant and useless background:
Images with mailhandler... back in 2003!
http://drupal.org/node/2702
I successfully implemented imagehandler.module for Drupal 4.0. Since mailhandler and image module has changed a lot since, you probably need retune the function. It currently supports only JPG.
function imagehandler_mailhandler($node, $stream, $msg_number, $mailbox) {
$image = mailhandler_get_part($stream, $msg_number, "IMAGE/JPEG");
if ($image) {
$node->type = "image";
$node->format = "jpg";
$node->body = mailhandler_get_part($stream, $msg_number, "TEXT/PLAIN");
$node->image_id = md5(rand());
$node->image_name = $node->title.".jpg";
$node->thumb_name = _image_thumbname($node);$dest = fopen(_image_tempname($node),"w");
fputs($dest,$image,strlen($image));
fclose($dest);watchdog("message", "Retreived image $node->image_name from incoming mail");
}
return $node;
}
Also old, but not as old:
mailsave module for drupal
http://www.stuartandnicola.com/node/433
mailhandler images names
More like this
- Send an e-mail to an administrator when a new user registers on a Drupal 7 site
- Drupal registration e-mail done right: no sending password back to user
- Site name with site e-mail (in return address of e-mails sent from the site)
- Send a confirmation e-mail when a webform is submitted (Drupal 6)
- Ask Agaric: Getting the E-mail Addresses of Your Site's Users


Comments
Post new comment