Actionmailer

I am trying to push emails that are being grabbed via POP3 (that part is
working) by getmail into actionmailer, and then parse the emails and
input the contents into a database. I keep getting the following load of
errors, and am at a total loss as to which direction to turn next. If
anyone has any input or ideas that could shed light on this, I’d really
appreciate the help.

Thanks!

The line in the getmail conf file that sends the mail to the rails app
is: arguments = (“sh”,"-c","cd

/home/nathan/rails/development/notifications; /usr/bin/ruby
script/runner ‘Incoming.receive(STDIN.read)’")

The incoming.rb file (in /app/models/):

Incoming < ActionMailer::Base

def receive(email)

notification = Notification.new

if email.from[0] == ‘[email protected]

notification.client_id == 11

else

notification.client_id == 1

end

if email.subject =~ /^(Backup Exec Alert: Job Completed with
Exceptions)/

notification.status = ‘e’

else

  notification.status = 'a'

end

notification.date_notified_on = ‘2006-04-27’

notification.note = email.body

notification.save

end

end

And the errors are:

Delivery error (command env 6998 error (1,

/usr/lib/ruby/gems/1.8/gems/rails-1.1.1/lib/commands/runner.rb:27:

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:140:in

`load’: ./app/models/incoming.rb:20: syntax error (SyntaxError)

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:140:in

`load’

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:56:in

`require_or_load’

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:30:in

`depend_on’

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:85:in

`require_dependency’

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:85:in

`require_dependency’

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:98:in

`const_missing’

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:131:in

`const_missing’

    from (eval):1

    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:21:in `eval'

    from

/usr/lib/ruby/gems/1.8/gems/rails-1.1.1/lib/commands/runner.rb:27

    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:21:in

`require__’

    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:21:in

`require’

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:147:in

`require’

    from script/runner:3))

msg 1/1 (120717 bytes), delivery error (command env 6998 error (1,

/usr/lib/ruby/gems/1.8/gems/rails-1.1.1/lib/commands/runner.rb:27:

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:140:in

`load’: ./app/models/incoming.rb:20: syntax error (SyntaxError)

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:140:in

`load’

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:56:in

`require_or_load’

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:30:in

`depend_on’

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:85:in

`require_dependency’

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:85:in

`require_dependency’

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:98:in

`const_missing’

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:131:in

`const_missing’

    from (eval):1

    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:21:in `eval'

    from

/usr/lib/ruby/gems/1.8/gems/rails-1.1.1/lib/commands/runner.rb:27

    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:21:in

`require__’

    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:21:in

`require’

    from

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depen
dencies.rb:147:in

`require’

    from script/runner:3))

Nathan M.

Operations Director

Northeast Region

Pilgrim IT, LLC

NORTHEAST OFFICE

1 Short Street

Northampton, MA 01060

TEL 413.517.5010 x201

FAX 413.587.0572

NOTICE: This email and any attachments are intended only for the
addressee and may contain information that is confidential and/or
legally privileged. If you are not the intended recipient or have
received this email in error, please notify the sender by return email
or by calling 866-434-4976. You should then delete the message and any
attachments or copies. If you are not the intended recipient, you are
prohibited from retaining, distributing, disclosing or using any
information contained herein.

On 28/04/2006, at 4:43 AM, Nathan M. wrote:

The incoming.rb file (in /app/models/):

Incoming < ActionMailer::Base

Shouldn’t that be:

class Incoming < ActionMailer::Base