I need to add a contact form to all nodes of a certain content type, so when a user submits the form it's delivered to the e-mail address of the author of the node. I tried using Webforms as a block with Contexts but Tokens doesn't work.
2 Answers
I ended using Webforms, passing the node author's e-mail using the token [current-page:node:author:mail] for passing the e-mail via a hidden field. I enabled the option to use the webform as a block and Context module for showing that block only in the desired content type.
With the lastest stable versions of Webforms and Token, I had to patch Token module as it's explained in this forum because the token wasn't working with Webforms.
There was a module for that, Author Contact. If you are using Drupal 6, it might still be good. If you are using later version, it's still a decent source of opensource code. There is Drupal 7 port, but I can't personally vouch for it. Seems good, but I only glanced at code. If it works, it will be the easiest way - because that's what it does, nothing less, nothing more.
Alternatively, you could give Entityform a try. It does not send email to author out of the box as far as I know, it was discussed on drupal.org, but if you are feeling lucky, it would be worth try again.