# Very weird ActionMailer issue

**URL:** <https://www.ruby-forum.com/t/very-weird-actionmailer-issue/66358>\
**Category:** Rails\
**Created:** [August 24, 2006, 11:03pm UTC](https://www.ruby-forum.com/t/very-weird-actionmailer-issue/66358 "2006-08-24T23:03:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [August 24, 2006, 11:03pm UTC](https://www.ruby-forum.com/t/very-weird-actionmailer-issue/66358/1 "2006-08-24T23:03:50Z")

</div>

I am trying to use one of my ActionMailer models. What I’m trying to do  
is deliver an email from within another model.

I keep getting this error:

#\<ActionView::ActionViewError: No rhtml, rxml, rjs or delegate template  
found for testaroo\>

I have checked the spelling about 20 times, check the file locations,  
etc. When I run the method from script/runner it works fine. I get the  
email. Here is what I’m running:

script/runner ‘Notifier.deliver\_testaroo’

Here is the method:

def testaroo(sent\_at = Time.now)  
subject “Testing”  
recipients ‘removed\_email\_address@domain.invalid’  
from “removed\_email\_address@domain.invalid”  
sent\_on sent\_at  
end

Why does it work in script/runner but not in another model?

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [August 24, 2006, 11:18pm UTC](https://www.ruby-forum.com/t/very-weird-actionmailer-issue/66358/2 "2006-08-24T23:18:34Z")

</div>

Ben J. wrote:

> I am trying to use one of my ActionMailer models. What I’m trying to do  
> is deliver an email from within another model.
> 
> I keep getting this error:
> 
> #\<ActionView::ActionViewError: No rhtml, rxml, rjs or delegate template  
> found for testaroo\>
> 
> I have checked the spelling about 20 times, check the file locations,  
> etc. When I run the method from script/runner it works fine. I get the  
> email. Here is what I’m running:
> 
> script/runner ‘Notifier.deliver\_testaroo’
> 
> Here is the method:
> 
> def testaroo(sent\_at = Time.now)  
> subject “Testing”  
> recipients ‘removed\_email\_address@domain.invalid’  
> from “removed\_email\_address@domain.invalid”  
> sent\_on sent\_at  
> end
> 
> Why does it work in script/runner but not in another model?
> 
> Thanks for your help.

Does it work from a controller (instead of a model)?

Michael

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [August 24, 2006, 11:20pm UTC](https://www.ruby-forum.com/t/very-weird-actionmailer-issue/66358/3 "2006-08-24T23:20:11Z")

</div>

Yes.

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [August 24, 2006, 11:50pm UTC](https://www.ruby-forum.com/t/very-weird-actionmailer-issue/66358/4 "2006-08-24T23:50:36Z")

</div>

Michael M. wrote:

> Ben J. wrote:
> 
> > Yes.
> 
> Should models be calling other models? It seems the controller should  
> interact with the model.
> 
> I’ll probably get blasted by everyone who reads this but it seems wrong  
> to have a model call a model.
> 
> Michael

Not to send emails. What if I want to send an email on a model action?  
Maybe if you modify a user or something. I don’t know, but I don’t see  
why that’s wrong.

This is probably the strangest issue I’ve had with rails.

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [August 25, 2006, 12:03am UTC](https://www.ruby-forum.com/t/very-weird-actionmailer-issue/66358/5 "2006-08-25T00:03:48Z")

</div>

Ben J. wrote:

> Michael M. wrote:
> 
> > Ben J. wrote:
> > 
> > > Yes.
> > 
> > Should models be calling other models? It seems the controller should  
> > interact with the model.
> > 
> > I’ll probably get blasted by everyone who reads this but it seems wrong  
> > to have a model call a model.
> > 
> > Michael
> 
> Not to send emails. What if I want to send an email on a model action?  
> Maybe if you modify a user or something. I don’t know, but I don’t see  
> why that’s wrong.
> 
> This is probably the strangest issue I’ve had with rails.

Ben,

Why don’t you just have your model call a function on its own controller  
and then have that function send the email? Maybe that will work…

Michael

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [August 24, 2006, 11:44pm UTC](https://www.ruby-forum.com/t/very-weird-actionmailer-issue/66358/6 "2006-08-24T23:44:18Z")

</div>

Ben J. wrote:

> Yes.

Should models be calling other models? It seems the controller should  
interact with the model.

I’ll probably get blasted by everyone who reads this but it seems wrong  
to have a model call a model.

Michael
