e-mail from rails 2.3.10 and ruby 1.8.7

Hi people, im trying to send e-mails using rails 2.3.10 and ruby 1.8.7

I have googled a lot but the best result i got was a code that not sent the e-mail and not dropped any error. Some one knows or has an example of a working e-malier for this version of rails and ruby?

Thanks in advance.

Edu

I hurd the best way to send emails on 2.3 was to upgrade to 3.2 or 4.0 and use Ruby 1.9.3+. To help you would be passively accept and reward using outdated, dead and possibly insecure technologies. I cannot do that.

At RailsConf this year, there was a vendor selling support for Rails 2.3. For a fairly steep bit of change, they will continue to patch Rails and Ruby for security, and provide support to developers who use their patched versions of same. Didn't write it down, since I've moved on, but there are major developers still using 2.3, on huge mission-critical applications that rely on it. You're not alone.

Walter

Hi Edu,

The way ActionMailer worked in 2.3 is quite different from the way it works now in 3.2 and 4.*. There are some older apps that you can look at pre-2.3 that had modles that used ActionMailer built in. ActionMailer did not change much between 2.1 and 2.3. The links that I will be providing in this example is from an app that is 2.1 but, when upgraded, will run under 2.3 with no changes to the model code for ActionMailer. The application is coded for ruby 1.8.7.

First you would want to setup your Model like by inheriting from ActionMailer. Then specify as methods each of the mail actions you wanted to take.

Model: https://github.com/insoshi/insoshi/blob/master/app/models/person_mailer.rb

Views: https://github.com/insoshi/insoshi/blob/master/app/views/person_mailer/blog_comment_notification.html.erb

https://github.com/insoshi/insoshi/blob/master/app/views/person_mailer/connection_request.html.erb

https://github.com/insoshi/insoshi/blob/master/app/views/person_mailer/email_verification.html.erb

You’ll also need to make sure you ActionMailer preferences are setup. This app did it by specifying them in an initializer because it pulled information from a database as to what should be specified for smtp.

Initializer: https://github.com/insoshi/insoshi/blob/master/config/initializers/email_settings.rb

Let us know how it goes. If you have any questions I will do my best to help answer them. Rails 2.3 was awhile ago so I’m a little rusty.

Thanks,

Bryan