Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By sndwav on
Hi all...
Is it possible to add an attachment field to drupal's core contact form?
I really liked that I let the users choose from a dropdown list the category that they want to mail about, and this sends a mail to a specific recipient for that category.
Is there a hack for it? some php code I can add?
I search around for it, but found only the Webform & Mailattach modules, which don't let me choose different recipients..
Thanks for any help!
-itai-
Comments
Don't hack! You'll only
Don't hack! You'll only regret it later.
One alternative is webform, where you can configure this. Another is to combine CCK and subscriptions and use a node access control module (there are many).
Laura
_____ ____ ___ __ _ _
design, snap, blog
_____ ____ ___ __ _ _
Laura Scott :: design » blog » tweet
-
A hack, for me, can mean even a mere alpha/beta upgrade ;)
It seems to much trouble to go into just for adding an attachment field (CCK+Subscriptions, then access control...).
Too bad it's not part of the code module itself... That's why I asked if someone ever added the necessary php code to add that field... if I knew php, I might do a duplicate of the core's contact form module that also supports attachments.
If only Webform had an option for directing mails to different recipients...
An example
Here is an example that I found the other day based on a php snippet that I think is in Drupal docs. Note that there are some features of this which are insecure. You need to go over each function with a fine toothed comb to ensure you are operating from an environment that doesn't invite spam or worse.
Just create a new node, dump this in the body text, ensure the filter is set to php code, save it, and then navigate to it.
You will need to modify the email addresses that are hard coded within if you want it to actually work.
-
I believe this is the same code I saw here (http://drupal.org/node/68265).
I couldn't get it to actually work
but it doesn't really matter since I must have the option of letting the guests & users to choose who they want to email to... and from what I can understand in that code, it has the hard-coded form fields and no such option.
I thought it would be nice to have a drop-down list, like in Drupal's core module, but I also must give them the option of attaching a file.
So I might use the Webform module (which has attachment ability, but no multichoice-recipients) to create several different forms and have a links-list of contacts for the users to choose from, and they will be directed to the appropriate webform.
If there is any way to enjoy both worlds (dropdown menu for choosing recipient & attachments) - it would be great...
Thanks...
-itai-
Or, you could read..
Or, you could read what I posted. ;-)
Have you tried the version I posted?
-
sorry I didn't read carefully... now I can see there is a 'person1', 'person2'...
yet I still get the exact same error... any idea?
Strip everything out
Strip everything out but one section. Run it. Does it run? If not, strip more out. Does it run? Add more. Does it run? Add more. Find the specific line with the error. Normal debugging.
=-=
Considering the only < in the code other then the opening php line is the
<pre>
you might try removing that.Any module
Is there any module that lets you add attachments to the personal contact forms? (Drupal 7), like if admin wants to contact one of the users and attach a file for her.
=-=
webform is likely a better fit for that task.
Stumbled upon (tm, je) this module..
http://drupal.org/project/contact_attach
Seems to do what you are asking. Didn't try it though.