I'm brand new to rails. I'm jumping right in with an existing app.
So, in app/models, I have contact_mailer.db
Looks like this:
In app/controllers/website_controller.rb I have this and it works:Code:class ContactMailer < ActionMailer::Base def validate_email(sendto, url) @recipients = sendto @from = "noreply@floridainternationalhomes.com" @subject = "Confirm Your Email Address" @body["url"] = url @sent_on = Time.now @headers = {} end def notify(contact) @recipients = "me@domain{dot}com" @from = "noreply@domain{dot}com" @subject = "Contact from Website" @body["contact"] = contact @headers = {} end end
But instead of using the validate_email method, which sends an email to the person who filled out the form, I want to send it to myself. I've tried this and it doesn't work:Code:wr = WebsiteRequest.new(params[:wr]) if wr.save id = wr.id id = Base64.b64encode("#{wr.id}") url = url_for( :controller => "website", :action => "email_confirmed", :id => id) email = ContactMailer.create_validate_email("#{wr.email}",url) ContactMailer.deliver(email) ... end
I've tried different things and I can't seem to get it. I've also tried calling ContactMailer.notify('Body') and that didn't work either.Code:email = ContactMailer.create_notify('This is the body of the email') ContactMailer.deliver(email)
Any ideas? Seems like a simple thing but I just can't get it.




Bookmarks