This is my first Rails project, and I may be missing something obvious, but... I need to send emails to a group of people, but the content is individualised, so I cannot bcc them, so I put it into a loop. It sends the first email OK then fails with an "uninitialized constant Admin::PrivateNewslettersController::NewsletterMailer" error. Fore testing I have reduced it to 3 addresses in test_arry, and taken out the encryption processing. In the controller I have: test_arry = [''email1-ee4meeAH724@public.gmane.org'', ''email2-ee4meeAH724@public.gmane.org'', ''email3-BUHhN+a2lJ4@public.gmane.org''] test_arry.each do |an_email| email = an_email name = ''john'' encrypted = [''abc''] NewsletterMailer.newsletter_email(email, name, encrypted) end In the Mailer I have: class Admin::NewsletterMailer < ActionMailer::Base default :from => "administrator@xxxxxxxx" def newsletter_email(email, name, encrypted) @name = name @url = "http://www.xxxxxxx/nl/download/"+encrypted.to_s mail(:to => email, :subject => "Dark Peak Newsletter") end end -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Nov 17, 5:26 pm, John Dalton <johnrdalt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> This is my first Rails project, and I may be missing something > obvious, but... I need to send emails to a group of people, but the > content is individualised, so I cannot bcc them, so I put it into a > loop. It sends the first email OK then fails with an "uninitialized > constant Admin::PrivateNewslettersController::NewsletterMailer" error. > > Fore testing I have reduced it to 3 addresses in test_arry, and taken > out the encryption processing. > In the controller I have: > test_arry = [''ema...-ee4meeAH724@public.gmane.org'', ''ema...-ee4meeAH724@public.gmane.org'', ''ema...-BUHhN+a2lJ4@public.gmane.org''] > test_arry.each do |an_email| > email = an_email > name = ''john'' > encrypted = [''abc''] > > NewsletterMailer.newsletter_email(email, name, encrypted)That should probably be Admin::NewsletterMailer,if your controller isn''t in the Admin module I suspect you''re getting lucky the first time round due to a quirk in the rails magic auto require stuff. Fred> end > > In the Mailer I have: > class Admin::NewsletterMailer < ActionMailer::Base > default :from => "administrator@xxxxxxxx" > > def newsletter_email(email, name, encrypted) > @name = name > @url = "http://www.xxxxxxx/nl/download/"+encrypted.to_s > mail(:to => email, :subject => "Dark Peak Newsletter") > end > > end-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Fred Many thanls, using Admin::NewsletterMailer does seem to have fixed it. John On Nov 18, 8:54 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Nov 17, 5:26 pm, John Dalton <johnrdalt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > This is my first Rails project, and I may be missing something > > obvious, but... I need to send emails to a group of people, but the > > content is individualised, so I cannot bcc them, so I put it into a > > loop. It sends the first email OK then fails with an "uninitialized > > constant Admin::PrivateNewslettersController::NewsletterMailer" error. > > > Fore testing I have reduced it to 3 addresses in test_arry, and taken > > out the encryption processing. > > In the controller I have: > > test_arry = [''ema...-ee4meeAH724@public.gmane.org'', ''ema...-ee4meeAH724@public.gmane.org'', ''ema...-BUHhN+a2lJ4@public.gmane.org''] > > test_arry.each do |an_email| > > email = an_email > > name = ''john'' > > encrypted = [''abc''] > > > NewsletterMailer.newsletter_email(email, name, encrypted) > > That should probably be Admin::NewsletterMailer,if your controller > isn''t in the Admin module I suspect you''re getting lucky the first > time round due to a quirk in the rails magic auto require stuff. > > Fred > > > > > > > > > end > > > In the Mailer I have: > > class Admin::NewsletterMailer < ActionMailer::Base > > default :from => "administrator@xxxxxxxx" > > > def newsletter_email(email, name, encrypted) > > @name = name > > @url = "http://www.xxxxxxx/nl/download/"+encrypted.to_s > > mail(:to => email, :subject => "Dark Peak Newsletter") > > end > > > end-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.