P
Peter Tellgren
I am trying to build a small newsletter application.
I am however failing somehomw..
I am trying this simple sample code:
<pre>
require 'net/http'
require 'rubygems'
require 'action_mailer'
recivers = []
recivers = IO.readlines("mial.txt")
h = Net::HTTP.new('http://...', 80)
resp, @data = h.get('...', nil)
ActionMailer::Base.default_content_type = "text/html"
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "...",
ort => 25,
:domain => '...'
}
class Emailer < ActionMailer::Base
def test_email(subject, user_email)
subject subject
from "..."
recipients user_email
body :body => @data
end
end
recivers.each do |reciver|
Emailer.deliver_test_email("Testing", reciver)
end
</pre>
And when I run this I get NoMethodError: undefined method
‘find_template’ for []:Array
I suppose I have to have a template somewhere but I can't figure out
where to put it?
All help welcome
I am however failing somehomw..
I am trying this simple sample code:
<pre>
require 'net/http'
require 'rubygems'
require 'action_mailer'
recivers = []
recivers = IO.readlines("mial.txt")
h = Net::HTTP.new('http://...', 80)
resp, @data = h.get('...', nil)
ActionMailer::Base.default_content_type = "text/html"
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "...",
:domain => '...'
}
class Emailer < ActionMailer::Base
def test_email(subject, user_email)
subject subject
from "..."
recipients user_email
body :body => @data
end
end
recivers.each do |reciver|
Emailer.deliver_test_email("Testing", reciver)
end
</pre>
And when I run this I get NoMethodError: undefined method
‘find_template’ for []:Array
I suppose I have to have a template somewhere but I can't figure out
where to put it?
All help welcome