Im trying to send an email see the code below:

Model: order_mailer.rb
class OrderMailer < ActionMailer::Base
def send_an_email()
@recipients = “[email protected]
@from = “[email protected]
@subject = “Ruby Test”
@body = “The Body”


View: send_an_email.rhtml

Email was sent!.

Controller: Admin.rb
def sendmail
OrderMailer::deliver_send_an_email() # notice the ‘deliver_’ prefix

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.server_settings = {
:address => “”,
:port => 25,
:user_name => “myusername”,
:password => “mypassword”,
:authentication => :login

ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.default_charset = “utf-8”
ActionMailer::Base.default_content_type = “text/html” # default:
ActionMailer::Base.default_mime_version = “1.0”
ActionMailer::Base.default_implicit_parts_order = [ “text/html”,

This code isnt working as no emails are beint sent or received. Can
anyone help me? How can debug whats happening to try and give me a clue
as no error messages are showing up.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs