[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

misiek

1/9/2006 8:04:00 PM

how to send e-mail with ruby on rails ?
7 Answers

Austin Ziegler

1/9/2006 8:12:00 PM

0

On 09/01/06, misiek <michaelaugustyniak@gazeta.pl> wrote:
> how to send e-mail with ruby on rails ?

Learn more about ActiveMailer here:

http://lists.rubyonrails.org/mailman/list...

-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca


Anatol Pomozov

1/9/2006 8:13:00 PM

0

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

On 1/9/06, misiek <michaelaugustyniak@gazeta.pl> wrote:
>
> how to send e-mail with ruby on rails ?
>
--
anatol (http://po...)

David Vallner

1/9/2006 8:29:00 PM

0

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 Vallner


Gary Wright

1/9/2006 9:03:00 PM

0


On Jan 9, 2006, at 3:29 PM, David Vallner 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 Wright





David Vallner

1/9/2006 11:27:00 PM

0

gwtmp01@mac.com wrote:

>
> On Jan 9, 2006, at 3:29 PM, David Vallner 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.

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

>
> 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 Wright
>
>
>
>
Anyways, that problem got resolved, but here's another quirk. My test
method went like:


class Notify
def notifier_test(test_message)
recipients "fred@example.com, barney@example.com,
wilma@example.com"
from "betty@example.com"
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!!



Jacob Fugal

1/9/2006 11:56:00 PM

0

On 1/9/06, David Vallner <david@vallner.net> wrote:
> Anyways, that problem got resolved, but here's another quirk. My test
> method went like:
>
>
> class Notify
> def notifier_test(test_message)
> recipients "fred@example.com, barney@example.com,
> wilma@example.com"
> from "betty@example.com"
> 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 %>

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 Fugal


David Vallner

1/10/2006 12:23:00 AM

0

Jacob Fugal wrote:

>On 1/9/06, David Vallner <david@vallner.net> wrote:
>
>
>>Anyways, that problem got resolved, but here's another quirk. My test
>>method went like:
>>
>>
>> class Notify
>> def notifier_test(test_message)
>> recipients "fred@example.com, barney@example.com,
>> wilma@example.com"
>> from "betty@example.com"
>> 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 %>
>>
>>
>
>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 Fugal
>
>
>
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 Vallner