# E-mail

**URL:** <https://www.ruby-forum.com/t/e-mail/94856>\
**Category:** Ruby\
**Created:** [January 9, 2006, 9:08pm UTC](https://www.ruby-forum.com/t/e-mail/94856 "2006-01-09T21:08:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![misiek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/76d3ee/32.png) [@misiek](https://www.ruby-forum.com/u/misiek)\
**Post date:** [January 9, 2006, 9:08pm UTC](https://www.ruby-forum.com/t/e-mail/94856/1 "2006-01-09T21:08:58Z")

</div>

how to send e-mail with ruby on rails ?

---

<div class="post-metadata">

**Author:** ![misiek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/76d3ee/32.png) [@misiek](https://www.ruby-forum.com/u/misiek)\
**Post date:** [January 9, 2006, 9:15pm UTC](https://www.ruby-forum.com/t/e-mail/94856/2 "2006-01-09T21:15:03Z")

</div>

On 09/01/06, misiek [removed\_email\_address@domain.invalid](mailto: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](http://lists.rubyonrails.org/mailman/listinfo/rails)

-austin

---

<div class="post-metadata">

**Author:** ![misiek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/76d3ee/32.png) [@misiek](https://www.ruby-forum.com/u/misiek)\
**Post date:** [January 9, 2006, 9:15pm UTC](https://www.ruby-forum.com/t/e-mail/94856/3 "2006-01-09T21:15:03Z")

</div>

[http://wiki.rubyonrails.com/rails/pages/HowToSendEmailsWithActionMailer](http://wiki.rubyonrails.com/rails/pages/HowToSendEmailsWithActionMailer)

---

<div class="post-metadata">

**Author:** ![misiek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/76d3ee/32.png) [@misiek](https://www.ruby-forum.com/u/misiek)\
**Post date:** [January 9, 2006, 10:06pm UTC](https://www.ruby-forum.com/t/e-mail/94856/4 "2006-01-09T22:06:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![misiek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/76d3ee/32.png) [@misiek](https://www.ruby-forum.com/u/misiek)\
**Post date:** [January 9, 2006, 9:30pm UTC](https://www.ruby-forum.com/t/e-mail/94856/5 "2006-01-09T21:30:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![misiek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/76d3ee/32.png) [@misiek](https://www.ruby-forum.com/u/misiek)\
**Post date:** [January 10, 2006, 12:29am UTC](https://www.ruby-forum.com/t/e-mail/94856/6 "2006-01-10T00:29:13Z")

</div>

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!!
```

---

<div class="post-metadata">

**Author:** ![misiek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/76d3ee/32.png) [@misiek](https://www.ruby-forum.com/u/misiek)\
**Post date:** [January 10, 2006, 12:56am UTC](https://www.ruby-forum.com/t/e-mail/94856/7 "2006-01-10T00:56:23Z")

</div>

On 1/9/06, David V. [removed\_email\_address@domain.invalid](mailto: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.

---

<div class="post-metadata">

**Author:** ![misiek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/76d3ee/32.png) [@misiek](https://www.ruby-forum.com/u/misiek)\
**Post date:** [January 10, 2006, 1:23am UTC](https://www.ruby-forum.com/t/e-mail/94856/8 "2006-01-10T01:23:33Z")

</div>

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.
