ActionMailer with sendmail any help


any good examples how to set up email (sendmail especially) with ruby on rails.

I have tried several examples from the net but no success.

I tried these instructions:

and what I have now in controller

  def generic_email(options)

@sent_on = options[:sent_on] || @recipients = options[:recipients] || "" @from = options[:from] || "Me <>" @cc = options[:cc] || "" @bcc = options[:bcc] || "" @subject = options[:subject] || "Test Email" @body = options[:body] || {} @headers = options[:headers] || {} @charset = options[:charset] || "utf-8"   end

def test       self.generic_email(options) end

when I run test http://localhost:3000/test

nothing happens ... no email ... cant see anything on the log etc

on environment.rb file i have

ActionMailer::Base.delivery_method = :sendmail ActionMailer::Base.perform_deliveries = true


any good examples how to set up email (sendmail especially) with ruby on rails.

Is your sendmail where rails expects it to be (usr/sbin/sendmail)? You can of course override this setting, but that is where it will look by default. Also, in order for an email to actually be send you need to call SomeMailer.deliver_generic_email (or create_generic_email and then send that). Lastly it sounds like you've defined generic_email on your controller, which obviously can't work. It needs to be defined on a subclass of ActionMailer::Base (script/generate mailer will generate you the right files)


what i have is this:


i got it to work i needed to add these on config/environments/ development.rb

ActionMailer::Base.delivery_method = :sendmail ActionMailer::Base.sendmail_settings = {   :location => '/usr/sbin/sendmail',   :arguments => '-i -t' }

#ActionMailer::Base.template_root = "mailer/templates"   # mailer will look for rhtml templates in that path   # example: "mailer/templates/my_mailer/signup_mail.rhtml" ActionMailer::Base.perform_deliveries = true # the "deliver_*" methods are available ActionMailer::Base.raise_delivery_errors = true ActionMailer::Base.default_charset = "utf-8" ActionMailer::Base.default_content_type = "text/html" # default: "text/ plain" ActionMailer::Base.default_mime_version = "1.0" ActionMailer::Base.default_implicit_parts_order = [ "text/html", "text/ plain"]

and config/environment.rb these

ActionMailer::Base.delivery_method = :sendmail #ActionMailer::Base.perform_deliveries = true ActionMailer::Base.raise_delivery_errors = true