ActionMailer Error - Please Help!

I’m trying to send an email to myself when someone comments on my site.
Here’s my code, if you don’t mind, could you tell me if you see
something wrong?

#environment.rb

Include your application configuration below

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.server_settings = {
:address => “mail.mydomain.com”,
:domain => “mail.mydomain.com”,
:port => 25,
:authentication => :login,
:user_name => “myuname”,
:password => “mypwd” }
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.default_charset = “utf-8”

#model - notifier.rb
class Notifier < ActionMailer::Base
def comment_alert(post)

Email header info MUST be added here

@recipients = “[email protected]
@from = “[email protected]
@subject = “New Comment”

Email body substitutions go here

@body[“first_name”] = “Fname”
@body[“last_name”] = “Lname”
@body[“title”] = post.title
end
end

#controller
def comments
content = Content.find(params[:id])
comment = Comment.new(params[:comment])
content.comments << comment
content.save
#call to send the email after the comment is saved
Notifier::deliver_comment_alert(content)
redirect_to :back
end

#view - notifier.rhtml

Hello <%= @first_name %> <%= @last_name %>,

There’s a new comment on <%= @title %>.

I’m getting an “Application error (Rails)” error. If you see something
wrong here, can you help me out please??? I really appreciate it.
Thanks!

hreyaatnh wrote:

I’m trying to send an email to myself when someone comments on my site.
Here’s my code, if you don’t mind, could you tell me if you see
something wrong?

#environment.rb

Include your application configuration below

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.server_settings = {
:address => “mail.mydomain.com”,
:domain => “mail.mydomain.com”,
:port => 25,
:authentication => :login,
:user_name => “myuname”,
:password => “mypwd” }
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.default_charset = “utf-8”

#model - notifier.rb
class Notifier < ActionMailer::Base
def comment_alert(post)

Email header info MUST be added here

@recipients = “[email protected]
@from = “[email protected]
@subject = “New Comment”

Email body substitutions go here

@body[“first_name”] = “Fname”
@body[“last_name”] = “Lname”
@body[“title”] = post.title
end
end

#controller
def comments
content = Content.find(params[:id])
comment = Comment.new(params[:comment])
content.comments << comment
content.save
#call to send the email after the comment is saved
Notifier::deliver_comment_alert(content)
redirect_to :back
end

#view - notifier.rhtml

Hello <%= @first_name %> <%= @last_name %>,

There’s a new comment on <%= @title %>.

I’m getting an “Application error (Rails)” error. If you see something
wrong here, can you help me out please??? I really appreciate it.
Thanks!

Hi,

it seems that your view should be “notifier/comment_alert.rhtml” and
this could be causing the error. in any case try looking in your log
what the error actually is about.


Agnieszka F.