KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm new to Ruby and wondering why I am getting an error in this situation using the 'mail' gem in a simple Sinatra app: post "/email/send" do @recipient = params[:email] Mail.deliver do to @recipient # throws error as this is undefined from 'server@domain.com' subject 'testing sendmail' body 'testing sendmail' end erb :email_sent end This however works fine: post "/email/send" do Mail.deliver do to 'me@domain.com' from 'server@domain.com' subject 'testing sendmail' body 'testing sendmail' end erb :email_sent end I suspect this is something to do with block scope and my misunderstanding of it.
Tags (comma-separated)
Save Edits
Cancel