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”
end
end
View: send_an_email.rhtml
Email was sent!.
Controller: Admin.rb
def sendmail
OrderMailer::deliver_send_an_email() # notice the ‘deliver_’ prefix
end
environment.rb
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.server_settings = {
:address => “auth.smtp.1and1.co.uk”,
: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:
“text/plain”
ActionMailer::Base.default_mime_version = “1.0”
ActionMailer::Base.default_implicit_parts_order = [ “text/html”,
“text/plain”]
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.