On Monday, July 29, 2013 9:44:56 AM UTC-5, Edu Mariano wrote:

> 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
>

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

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/dc0dd170-74e1-4137-a077-602095905e7b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to