Button to trigger mailer?

dansinker
2009-07-17T02:35:03Z

Newbie ActionMailer question:

I''ve created a mailer, and am pretty sure I''ve set its
parameters
correctly.

I''ve created a view for that mailer, and am also pretty sure
I''ve set
it up correctly.

I can call the mailer and it works right when I put the deliver_ in
another controller or simply on a page.

So all that''s great.

BUT, what I really want to do is have a simple button that, when hit,
will trigger that mailer, passing an :id to it as well.

I can''t figure out how to code the button though. Any ideas?

here''s what''s in the mode:

def scheduled(story)
 recipients 	story.author.email
 subject 		"Your story has been scheduled"
 from 		"e-mail-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org"
 sent_on 		Time.now
 body 		:story => story
end

here''s the template (excerpt):
Hi <%= @story.author.name %>
....

here''s the deliver_ action:  Emailer.deliver_scheduled(@story)

Again, all this stuff works but I can''t seem to figure out how to
simply smack a button and send an e-mail. I''m sure it''s
something I''m
just overlooking.

Thanks!