Active
Project:
Email Field
Version:
6.x-1.2
Component:
Code
Priority:
Critical
Category:
Support request
Assigned:
Issue tags:
Reporter:
Created:
13 Jul 2010 at 13:42 UTC
Updated:
11 Oct 2011 at 07:52 UTC
Hello,
I am trying to send email with attachment using hook mail.
I am using it in a content type with a file upload field.
When a node is created, I wish that file should be sent to some email address as an attachment.
I am able to send fields content like description or title.
But can send attachment.
$mailto='myemail@mail.com';
$file='FilePathHere';//What to do with this
$params = array(
'file' => $file,
'name' => 'Tanvir Ahmad','content'=> $content);
drupal_mail('MODULNAME', 'triggerkey', $mailto, language_default(), $params);
function MODULNAME_mail($key, &$message, $params) {
switch ($key) {
case 'triggerkey':
// note: data can be passed to this function in the $params array -
$message['subject'] = t('EMAIL SUBJECT');
$message['body'] = $params['file'].$params['name'];
break;
}
}
Response is appriciated.
Thnks
Comments
Comment #1
tanvirahmad commentedComment #2
drupalnesia commentedRead this: http://drupal.org/node/159678