Steve
2007-Apr-06 19:21 UTC
Question on creating small mailing list within large application
I am relatively new to Ruby on Rails and so I am finding myself stuck on an issue for a web site I am currently designing. I would like to create a simple mailing list form that just sends the information from the form fields straight to an email account. I want this form to be inside of a larger application which is much like a blog. What is the best way of going about this? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Luke Ivers
2007-Apr-06 20:11 UTC
Re: Question on creating small mailing list within large application
Rails has a built in mailing mechanism known as ActionMailer... there are TONS of good resources on setting this up correctly, and I''ll leave that part to our friend Google. Basically, you can do this two ways: set up this form, and have it post to an action that takes the information, sends it over to your already set up action mailer, and then redirects you to a page telling you your mail was succesfully sent. However, if you don''t want to interrupt the flow of your program to much, this is an almost perfect use case for getting into some AJAX. Simply have the submit button on your form use AJAX instead of a regular submit, and it will do all the mailing in the background, and then come back and tell your page that it is done mailing. If you''re talking about having the same form perform more than one action (such as, when they click on post to post a blog entry, it also sends an email), it is simple to have your action you are sending the blog post information to also create an email out of what you have sent... in the application I''m currently working on, we use the wonderful Rails method render_to_string to accomplish this, as that allows us to even use a view, layout, etc just like normal, and pass the resulting nicely formatted HTML stuff off to an action mailer. On 4/6/07, Steve <sdf259-RWB/UN2hA5c@public.gmane.org> wrote:> > > I am relatively new to Ruby on Rails and so I am finding myself stuck > on an issue for a web site I am currently designing. > > I would like to create a simple mailing list form that just sends the > information from the form fields straight to an email account. I want > this form to be inside of a larger application which is much like a > blog. What is the best way of going about this? > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Steve
2007-Apr-06 21:31 UTC
Re: Question on creating small mailing list within large application
Thanks Luke On Apr 6, 4:11 pm, "Luke Ivers" <technod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Rails has a built in mailing mechanism known as ActionMailer... there are > TONS of good resources on setting this up correctly, and I''ll leave that > part to our friend Google. > > Basically, you can do this two ways: set up this form, and have it post to > an action that takes the information, sends it over to your already set up > action mailer, and then redirects you to a page telling you your mail was > succesfully sent. However, if you don''t want to interrupt the flow of your > program to much, this is an almost perfect use case for getting into some > AJAX. Simply have the submit button on your form use AJAX instead of a > regular submit, and it will do all the mailing in the background, and then > come back and tell your page that it is done mailing. > > If you''re talking about having the same form perform more than one action > (such as, when they click on post to post a blog entry, it also sends an > email), it is simple to have your action you are sending the blog post > information to also create an email out of what you have sent... in the > application I''m currently working on, we use the wonderful Rails method > render_to_string to accomplish this, as that allows us to even use a view, > layout, etc just like normal, and pass the resulting nicely formatted HTML > stuff off to an action mailer. > > On 4/6/07, Steve <sdf...-RWB/UN2hA5c@public.gmane.org> wrote: > > > > > I am relatively new to Ruby on Rails and so I am finding myself stuck > > on an issue for a web site I am currently designing. > > > I would like to create a simple mailing list form that just sends the > > information from the form fields straight to an email account. I want > > this form to be inside of a larger application which is much like a > > blog. What is the best way of going about this?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---