E-mail


#1

how to send e-mail with ruby on rails ?


#2

On 09/01/06, misiek removed_email_address@domain.invalid wrote:

how to send e-mail with ruby on rails ?

Learn more about ActiveMailer here:

http://lists.rubyonrails.org/mailman/listinfo/rails

-austin


#3

http://wiki.rubyonrails.com/rails/pages/HowToSendEmailsWithActionMailer


#4

On Jan 9, 2006, at 3:29 PM, David V. wrote:

Speaking of which, by mere coinkydink I needed that article right
now too. Yet my ISPs SMTP server doesn’t seem to let me through;
does anyone know what are the common limitations that ISPs enforce
on e-mails sent via their SMTP servers? I’m wondering whether
setting my HELO domain to my webhost’s as opposed to something that
looks like what the ISP might have given me could cause a failure
in the mail being deliverred.

Many ISPs block outbound TCP connections to port 25 (the SMTP port).
They require you to connect to the mail server provided by the ISP,
which will then deliver the mail outside the ISP’s network.

Some ISPs have a procedure to lift the outbound port 25 filters for
specific
customers. You’ll have to check with your ISP.

You can thank the spammers for this situation. It is designed to
provide
a mechanism for auditing outgoing email such that spam sources can be
identified
and shutdown before they cause the ISP to be put on various
blacklists as a source
of spam. If your address block gets put on such a list it can have
a serious
operational impact (i.e. email to/from your customers stops flowing)
so ISP’s
have to be aggressive about identifying and eliminating sources of SPAM.

Gary W.


#5

Speaking of which, by mere coinkydink I needed that article right now
too. Yet my ISPs SMTP server doesn’t seem to let me through; does anyone
know what are the common limitations that ISPs enforce on e-mails sent
via their SMTP servers? I’m wondering whether setting my HELO domain to
my webhost’s as opposed to something that looks like what the ISP might
have given me could cause a failure in the mail being deliverred.

More generally, is there any way to check on the status of a mail sent
via SMTP?

David V.


#6

removed_email_address@domain.invalid wrote:

Many ISPs block outbound TCP connections to port 25 (the SMTP port).
They require you to connect to the mail server provided by the ISP,
which will then deliver the mail outside the ISP’s network.

Well, my ISP is rather happy with anything I do, I had a problem which
seemed like a server config failure. Turned out silly me was using a
semicolon instead of a comma to separate multiple recipients…

blacklists as a source

Anyways, that problem got resolved, but here’s another quirk. My test
method went like:

class Notify
    def notifier_test(test_message)
        recipients "removed_email_address@domain.invalid, removed_email_address@domain.invalid,
removed_email_address@domain.invalid"
        from "removed_email_address@domain.invalid"
        subject "Notifier Test"

        body ["test_message" = test_message]
    end
end

(That’s using the traits versions of the code).

And the template was:

Notifier Test

Test message: <%= @test_message %>

And when I tried to go Notify.deliver_notifier_test(“Testing.”) in a
Rails console, I got a very weird Exception / traceback, possibly while
compiling the ERB template:

ActionView::TemplateError:

ActionView::TemplateError (`@test_messageTesting.' is not allowed as
an instance
 variable name) on line #0 of 

app/views/notify_tn1/notifier_test.rhtml:
1: This is a notifier test e-mail.
2:
3: The test message is: <%= @test_message %>

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:333
:in `instance_variable_set'

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:333
:in `assign_variables_from_controller'

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:333
:in `assign_variables_from_controller'

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:323
:in `evaluate_assigns'

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:264
:in `compile_and_render_template'

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:244
:in `render_template'

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:205
:in `render_file'

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:226
:in `render'

d:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:
357:in `render'

d:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:
352:in `render_message'

d:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:
300:in `create!'

d:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:
263:in `initialize'
    d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`new'

d:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:
223:in `method_missing'
    (irb):1:in `irb_binding'
    d:/ruby/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
    d:/ruby/lib/ruby/1.8/irb/workspace.rb:52


        from On line #0 of app/views/notify_tn1/notifier_test.rhtml

    1: This is a notifier test e-mail.
    2:
    3: The test message is: <%= @test_message %>

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:333
:in `instance_variable_set'

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:333
:in `assign_variables_from_controller'

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:333
:in `assign_variables_from_controller'

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:323
:in `evaluate_assigns'

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:264
:in `compile_and_render_template'

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:244
:in `render_template'

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:205
:in `render_file'

d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:226
:in `render'

d:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:
357:in `render'

d:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:
352:in `render_message'

d:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:
300:in `create!'

d:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:
263:in `initialize'
    d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`new'

d:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:
223:in `method_missing'
    (irb):1:in `irb_binding'
    d:/ruby/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
    d:/ruby/lib/ruby/1.8/irb/workspace.rb:52
Maybe IRB bug!!

#7

On 1/9/06, David V. removed_email_address@domain.invalid wrote:

Test message: <%= @test_message %>
 variable name) on line #0 of app/views/notify_tn1/notifier_test.rhtml:
1: This is a notifier test e-mail.
2:
3: The test message is: <%= @test_message %>

I’ve not used ActionMailer, so I’m not sure what the syntax should be,
but my guess is the line:

  body ["test_message" = test_message]

Is causing the error. Maybe that should be:

  body ["test_message" => test_message]

???

Jacob F.


#8

Jacob F. wrote:

removed_email_address@domain.invalid"

but my guess is the line:

No, that’s a typo I made in the e-mail - that wouldn’t compile right out
instead of getting as far as the ERB template. I suppose I should
subscribe to the Rails lists for this. (Oh noes, more spam in my
mailbox)

David V.