# Actionmailer sends from commandline but not from web

**URL:** <https://www.ruby-forum.com/t/actionmailer-sends-from-commandline-but-not-from-web/147741>\
**Category:** Rails\
**Created:** [September 4, 2008, 10:26pm UTC](https://www.ruby-forum.com/t/actionmailer-sends-from-commandline-but-not-from-web/147741 "2008-09-04T22:26:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [September 4, 2008, 10:26pm UTC](https://www.ruby-forum.com/t/actionmailer-sends-from-commandline-but-not-from-web/147741/1 "2008-09-04T22:26:36Z")

</div>

Hello all,

I’m having trouble with this simple email class I made for postbacks.  
When I run this from the command line an email is sent, however when I  
access this .rb file through a browser nothing happens.

* * *

#!/usr/bin/ruby  
require “rubygems”  
require “action\_mailer”

ActionMailer::Base.delivery\_method = :smtp

ActionMailer::Base.smtp\_settings = {  
:address =\> “[smtp.domain.com](http://smtp.domain.com)”,  
:port =\> “25”,  
:domain =\> “[domain.com](http://domain.com)”  
}

class Emailer \< ActionMailer::Base  
def test()  
recipients “removed\_email\_address@domain.invalid”  
from “removed\_email\_address@domain.invalid”  
subject “subject”  
body “body”  
end  
end

## Emailer.deliver\_test()

I’m running Apache 2.2, and this is what my ruby.conf file for it looks  
like:

* * *

LoadModule ruby\_module modules/mod\_ruby.so

 RubyRequire apache/ruby-run RubyRequire apache/eruby-run
## \<Files \*.rb\> SetHandler ruby-object RubyHandler Apache::RubyRun.instance \<Files \*.erb\> SetHandler ruby-object RubyHandler Apache::ERubyRun.instance

ExecCGI in enabled as well.

Any ideas?

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [September 5, 2008, 4:02pm UTC](https://www.ruby-forum.com/t/actionmailer-sends-from-commandline-but-not-from-web/147741/2 "2008-09-05T16:02:01Z")

</div>

Fixed.

It was an SELinux issue. I googled around after looking in Apache’s  
error log, I had to allow HTTP scripts to contact the network.

Dave
