Rails contact form not working - ruby-on-rails

I am trying to create a contact the form gets submitted. But I don't receive any email.
In my config/application.rb I have addded.
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "mail.vinderhimlen.dk",
:port => 587,
:user_name => "asd#vinderhimlen.dk",
:password => "x",
:authentication => :login
}
My form:
<%= simple_form_for [#support], :url => { :action => "create" }, :html => { :method => :post } do |f| %>
<%= f.input :sender_name, :label => 'Navn' %>
<%= f.input :email, :label => 'E-mail' %>
<%= f.input :support_type, :collection => ['Feedback', 'Idé', "Rapporter fejl", 'Business', 'Andet'], :prompt => "Valg type", :label => 'Erinde' %>
<%= f.label :Besked %>
<%= f.text_area :content, :label => 'Besked', :style => 'width:500px;', %>
<%= f.submit "submit", :value => 'Send besked' %>
<% end %>
My Supportscontroller:
class SupportsController < ApplicationController
def new
# id is required to deal with form
#support = Support.new(:id => 1)
end
def create
#support = Support.new(params[:support])
if #support.save
redirect_to('/', :notice => "Support was successfully sent.")
else
flash[:alert] = "You must fill all fields."
render 'new'
end
end
end
My Support model:
class Support
include ActiveModel::Validations
validates_presence_of :email, :sender_name, :support_type, :content
# to deal with form, you must have an id attribute
attr_accessor :id, :email, :sender_name, :support_type, :content
def initialize(attributes = {})
attributes.each do |key, value|
self.send("#{key}=", value)
end
#attributes = attributes
end
def read_attribute_for_validation(key)
#attributes[key]
end
def to_key
end
def save
if self.valid?
Notifier.support_notification(self).deliver
return true
end
return false
end
end
My config/enviroments/devolpment:
Konkurranceportalen::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
config.perform_delivery = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = true
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
end
My rails log on when submitting the form:
Started POST "/supports" for 127.0.0.1 at 2011-05-31 11:15:35 +0200
Processing by SupportsController#create as HTML
Parameters: {"utf8"=>"Ô£ô", "authenticity_token"=>"bn05TaU4o6TwLVwYH0PgnDyYouo
P1HptzW3HHY2QV/s=", "support"=>{"sender_name"=>"asdasd", "email"=>"ssad#sazdasd.
dk", "support_type"=>"Id├®", "content"=>"asdasd"}, "commit"=>"Send besked"}
←[1m←[36mSQL (0.0ms)←[0m ←[1mSELECT SUM(`tags`.`konkurrancers_count`) AS sum_
id FROM `tags`←[0m
←[1m←[35mSQL (8.0ms)←[0m describe `kategoris_konkurrancers`
←[1m←[36mKonkurrancer Load (1.0ms)←[0m ←[1mSELECT `konkurrancers`.* FROM `kon
kurrancers`←[0m
←[1m←[35mCACHE (0.0ms)←[0m SELECT `konkurrancers`.* FROM `konkurrancers`
←[1m←[36mTag Load (1.0ms)←[0m ←[1mSELECT `tags`.* FROM `tags`←[0m
Rendered notifier/support_notification.html.erb (1.0ms)
Sent mail to asd#vinderhimlen.dk (1752ms)
Date: Tue, 31 May 2011 11:15:39 +0200
From: ssad#sazdasd.dk
To: asd#vinderhimlen.dk
Message-ID: <4asdqweb124ce_16cc85248bc677b3#Home-Pc.mail>
Subject: =?UTF-8?Q?New_Id=C3=A9?=
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: quoted-printable
=EF=BB=BFhello world!
asdasd=
Redirected to http://localhost:3000/
Completed 302 Found in 4503ms

To trigger mails in dev mode, add this to your development.yml file:
config.action_mailer.perform_deliveries = true

Related

Connection refused - connect(2) for "localhost" port 1025

I am going through this tutorial (link:https://www.murdo.ch/blog/build-a-contact-form-with-ruby-on-rails-part-1) to create a simple contact us form on my existing rails application. After completing the tutorial and testing on my development environment I notice that my smtp settings are interferring with my contact us form. Basically I just want send a message to an email address so I dont need the sender mail address for this. I tried removing the SMTP settings in my development.rb file but then I get this error when clicking the submit button:
Errno::ECONNREFUSED in MessagesController#create
Connection refused - connect(2) for "localhost" port 1025
I tried solving in different ways but I come back to this same error. Here's my code:
model/message.rb:
class Message
include ActiveModel::Model
attr_accessor :name, :email, :body
validates :name, :email, :body, presence: true
end
Here's my message controller:
class MessagesController < ApplicationController
def new
#message = Message.new
end
def create
#message = Message.new message_params
if #message.valid?
MessageMailer.contact_me(#message).deliver_now
redirect_to new_message_url, notice: "Message received"
else
render :new
end
end
def message_params
params.require(:message).permit(:name, :email, :body)
end
end
My view:new.html.erb:
<%= form_for #message, url: create_message_url do |f| %>
<%= notice %>
<%= #message.errors.full_messages.join(', ') %>
<%= f.text_field :name, placeholder: 'name' %>
<%= f.email_field :email, placeholder: 'email' %>
<%= f.text_area :body, placeholder: 'body' %>
<%= f.submit 'Send' %>
<% end %>
My Mailer:
class MessageMailer < ApplicationMailer
def contact_me(message)
#greeting = 'Hi'
#body = message.body
mail to: "notifications#example.com", from: message.email
end
end
And my Development.rb/SMTP settings code:
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
:address => 'localhost',
:port => 587,
:domain => 'localhost:3000',
:user_name => 'example#gmail.com',
:password => '######',
:authentication => 'plain',
:enable_starttls_auto => true
}
I just want to get rid of the smtp settings but unfortunately I cannot, is there any way to override these settings or an alternate solution or am I missing something,
Any help will be appreciated,
Thanks in advance

Is attr_accessor the issue with this contact form in Rails 4?

First off, i know attr_accessible is deprecated in Rails 4, but what about attr_accessor?
When you hit submit it's returning a "Template is Missing" error, but that's because its hitting an error somewhere in the send proccess then just trying to return "connect#create" which doesn't exist as a physical page.
When i check the log files, I am getting a 500 internal server error when trying to send a contact form, and I'm not sure if using attr_accessor in Rails 4 is the culprit. Is there a newer way to write this?
class Message
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_accessor :name, :email, :phone, :subject, :company, :title, :market, :body
validates :name, :email, :subject, :company, :body, :presence => true
validates :email, :format => { :with => %r{.+#.+\..+} }, :allow_blank => true
def initialize(attributes = {})
attributes.each do |name, value|
send("#{name}=", value)
end
end
def persisted?
false
end
end
The above is the message model for the contact form:
Is it something within the process of sending the data?
The rest of the code for the contact mail functionality is:
Contact Mailer
class ContactMailer< ActionMailer::Base
default :from => "noreply#test.com"
default :to => "{{MY EMAIL}}"
def new_message(message)
#message = message
mail(:subject => "Test Message")
end
end
In /views/contact_mailer/ there is a new_message.text.erb file:
Name: <%= #message.name %>
Email: <%= #message.email %>
Phone: <%= #message.phone %>
Subject: <%= #message.subject %>
Company: <%= #message.company %>
Title: <%= #message.title %>
Market: <%= #message.market %>
Body: <%= #message.body %>
My Routes are:
match 'connect' => 'connect#index', :as => 'connect', :via => :get
match 'connect' => 'connect#create', :as => 'connectpost', :via => :post
The connect page controller:
class ConnectController < ApplicationController
def index
#message = Message.new
end
def create
#message = Message.new(params[:message])
if #message.valid?
NotificationsMailer.new_message(#message).deliver
redirect_to(connect_path, :notice => "Message was successfully sent.")
else
flash.now.alert = "Please fill all fields."
render :new
end
end
end
And finally....the SMTP settings in /config/initializers/smtp_settings.rb
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "{{SITE DOMAIN}}",
:user_name => "{{GMAIL EMAIL}}",
:password => "{{GMAIL EMAIL PASSWORD}}",
:authentication => "plain",
:enable_starttls_auto => true
}
My ConnectController#Create was trying to initialize
NotificationMailers.new_message()
But it needed to be:
ContactMailer.new_message()
I have no idea why the tutorial I followed would have the wrong class name there...but that was the issue.
Thanks all.
attr_accessor, attr_writer and attr_reader are all part of vanilla core Ruby and are helper methods for Modules and Classes.
They work fine in Ruby 2.0, so you'll have to mark them off your suspect list.

new find view is being processed as new create request

I had a question earlier on this, I am trying to make a ldap search form.
So far I did rails generate for users/find. In the model I have a function to search a user in ldap, which works fine independently outside of rails.
but the request through this view is actually getting treated as a request to create a new user, instead to just search the user in ldap.
I am new to rails, dont what the missing link is. Need some help here understanding this, in future there will be a lot of functions/features like this I have to add in this test app. Which I think will probably lead to the same issue.
# rails generate controller users find
error -
undefined method `gsub' for nil:NilClass
Started GET "/users/find" for 10.85.41.23 at 2012-04-05 19:56:27 -0400
Processing by UsersController#find as HTML
Completed 500 Internal Server Error in 15ms
NoMethodError (undefined method `gsub' for nil:NilClass):
app/models/user.rb:54:in `FindActiveDirectory'
app/controllers/users_controller.rb:10:in `find'
Model -
class User < ActiveRecord::Base
attr_accessible :user_id, :firstname, :lastname, :email, :role, :misc, :password
validates_presence_of :user_id, :firstname, :lastname, :email, :role, :on => :create
validates_uniqueness_of :user_id, :email
ROLES = ['Admin','User']
####################
SERVER = '10.10.10.1'
PORT = 389
BASE = 'DC=User,DC=mysite,DC=com'
DOMAIN = 'ldap.mysite.com'
####################
def self.ActiveDirectoryAuthenticate(login, pass)
user = find_by_user_id(login)
if user
nil
else
return false
end
conn = Net::LDAP.new :host => SERVER,
:port => PORT,
:base => BASE,
:auth => { :username => "#{login}##{DOMAIN}",
:password => pass,
:method => :simple }
if conn.bind
return user
else
return false
end
rescue Net::LDAP::LdapError => e
return false
end
def self.FindActiveDirectory(login)
conn = Net::LDAP.new :host => SERVER,
:port => PORT,
:base => BASE,
:auth => { :username => 'admin',
:password => 'adminpass',
:method => :simple }
if conn.bind
conn.search(:base => BASE, :filter => Net::LDAP::Filter.eq( "sAMAccountName", login ),
:attributes => ['givenName','SN','mail'], :return_result => true) do |entry|
entry.each do |attributes, values|
if "#{attributes}" == "sn"
values.each do |value|
puts "Lastname: "+"#{value}"
$lastname = "#{value}"
end
end
if "#{attributes}" == "givenname"
values.each do |value|
puts "Firstname: "+"#{value}"
$firstname = "#{value}"
end
end
if "#{attributes}" == "mail"
values.each do |value|
puts "Email: "+"#{value}"
$email = "#{value}"
end
end
end
end
return true
else
return false
end
rescue Net::LDAP::LdapError => e
return false
end
end
controller -
class UsersController < ApplicationController
def new
#user = User.new
end
def find
#user = User.FindActiveDirectory(params[:user_id])
end
def create
#user = User.new(params[:user_id])
if #user.save
redirect_to users_added_url, :notice => "Signed up!"
else
render "new"
end
end
end
View -
<h1>Users#find</h1>
<%= form_for #user do |f| %>
<% if #user.errors.any? %>
<div class="error_messages">
<h2>Form is invalid</h2>
<ul>
<% for message in #user.errors.full_messages %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<p>
<%= f.label :Username %><br />
<%= f.text_field :user_id %>
</p>
<p class="button"><%= f.submit %></p>
<% end %>
routes -
rubyapp::Application.routes.draw do
get "users/find"
get "myapp/new"
root :to => "sessions#new"
#root :to => "home#index"
get "sessions/new"
get "users/new"
get "users/added" => "users#added"
get "myapp" => "myapp#new"
get "log_out" => "sessions#destroy", :as => "log_out"
get "log_in" => "sessions#new", :as => "log_in"
get "sign_up" => "users#new", :as => "sign_up"
resources :users
resources :sessions
end
You need another method to handle the data you returned:
the controller:
def find
end
def display_result
#result = User.findActiveDirectory( params[:user_id] )
if #result.empty?
render action: "find", notice: "Could not find a user with id #{params[:user_id]}"
end
end
next step is to add a route to the routes.rb:
get 'users/find'
post 'users/display_result'
now we have to update the view for find:
<h1>Users#find</h1>
<p><%= notice %></p>
<%= form_tag users_display_result_path do %>
<p>
<%= label_tag :Username %><br />
<%= text_field_tag :user_id %>
</p>
<p class="button"><%= submit_tag %></p>
<% end %>
and create the new view for displaying the result (this one is very basic, i guess you need to improve this a lot, but this should give you an idea):
<h1>Users#display_result</h1>
<%= debug #result %>
and last but not least change some stuff in the model:
def self.FindActiveDirectory(login)
conn = Net::LDAP.new :host => SERVER,
:port => PORT,
:base => BASE,
:auth => { :username => 'admin',
:password => 'adminpass',
:method => :simple }
if conn.bind
result = HashWithIndifferentAccess.new
conn.search( :base => BASE,
:filter => Net::LDAP::Filter.eq( "sAMAccountName", login ),
:attributes => ['givenName','SN','mail'],
:return_result => true
) do |entries|
entries.each do |attribute, value|
result[attribute] = value
end
end
return result
rescue Net::LDAP::LdapError => e
return false
end
You will end up in the controller/ view with a variable called #result. This variable is a hash with the attributes as key. So you could do something like this in the view:
<% #result.each do |key,value| %>
<%= key.to_s.normalize + ": " + value.to_s %>
<% end >

Action Mailer Invites Rails 3.1

Using Ryan Bate's RailsCasts #124 Beta Invites (as well as the updated rails 3.1 api) as a crutch, I'm trying to put together my first piece of Action Mailer functionality: inviting someone to collaborate with you on a project.
My issue is that the :recipient_email isn't getting saved in the DB and I can't see what I'm missing.
config/initializers/setup_mail.rb
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'blah.com',
:user_name => 'gmail username',
:password => 'gmail password',
:authentication => 'plain',
:enable_starttls_auto => true
}
ActionMailer::Base.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development?
app/models/invitation.rb
class Invitation < ActiveRecord::Base
email_regex = /\A[\w+\-.]+#[a-z\d\-.]+\.[a-z]+\z/i
attr_accessor :recipient_email
belongs_to :sender, :class_name => "User", :foreign_key => "sender_id"
has_one :recipient, :class_name => "User", :foreign_key => "recipient_id"
validates_presence_of :recipient_email, :on => :create, :message => "can't be blank"
validates :recipient_email, :format => email_regex
validate :recipient_is_not_registered
before_create :generate_token
def sender_name
sender.user_name
end
def sender_email
sender.email
end
private
def recipient_is_not_registered
exsisting_user = User.find_by_email(recipient_email)
if exsisting_user
errors.add :recipient_email, 'is already a member.'
else
recipient_email
end
end
def generate_token
self.token = Digest::SHA1::hexdigest([Time.now, rand].join)
end
end
app/models/user.rb (minus all the auth stuff)
class User < ActiveRecord::Base
attr_accessible :invitation_token
has_many :sent_invitations, :class_name => "Invitation", :foreign_key => "sender_id"
belongs_to :invitation
end
app/controller/invitations_controller.rb
class InvitationsController < ApplicationController
before_filter :authenticate
def new
#title = "Invite client"
#invitation = current_user.sent_invitations.new
end
def create
#invitation = current_user.sent_invitations.create!(params[:invitation])
sender_name = #invitation.sender_name
sender_email = #invitation.sender_email
if #invitation.save
Mailer.invitation(#invitation, signup_url(#invitation.token), sender_name, sender_email).deliver
flash[:success] = "Your client has been sent the email. Why not create a booking for them?"
redirect_to bookings_path
else
#title = "Invite client"
render :new
end
end
end
app/mailers/mailer.rb
def invitation(invitation, signup_url, sender_name, sender_email)
#signup_url = signup_url
#sender_name = sender_name
#sender_email = sender_email
mail(:to => invitation.recipient_email,
:subject => "Invitation to Join",
:from => #sender_email)
end
app/views/invitations/_invitation_form.html.erb
<%= form_for #invitation do |f| %>
<%= render 'shared/error_messages', :object => f.object %>
<%= f.hidden_field :email_token %>
<br />
<div class="field">
<%= f.label :recipient_email, "Client's email address" %>
<%= f.email_field :recipient_email %>
</div>
<br />
<div class="action">
<%= f.submit "Send invitation", :class => "a small white button radius" %>
</div>
<% end %>
The SQL log showing that the :recipient_email isn't getting saved
Started POST "/invitations" for 127.0.0.1 at 2011-12-14 21:27:11 +1100
Processing by InvitationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"7/SGZypGXtf9ShlcjC6o8ZRj2Qe4OJTHdjis2/m3ulc=", "invitation"=>{"recipient_email"=>"users#email.com"}, "commit"=>"Send invitation"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
(0.1ms) BEGIN
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'users#email.com' LIMIT 1
SQL (0.4ms) INSERT INTO "invitations" ("created_at", "recipient_email", "sender_id", "sent_at", "token", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["created_at", Wed, 14 Dec 2011 10:27:11 UTC +00:00], ["recipient_email", nil], ["sender_id", 1], ["sent_at", nil], ["token", "56fba1647d40b53090dd49964bfdf060228ecb2d"], ["updated_at", Wed, 14 Dec 2011 10:27:11 UTC +00:00]]
(10.2ms) COMMIT
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
(0.1ms) BEGIN
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'users#email.com' LIMIT 1
(0.1ms) COMMIT
Rendered mailer/invitation.text.erb (0.4ms)
Sent mail to users#email.com (7ms)
Date: Wed, 14 Dec 2011 21:27:11 +1100
From: admin#email.com
It's probably the attr_accessor :recipient_email line in your Invitation model. Take that line out as recipient_email is a database field, ain't it?

Rails 3 actionmail OpenSSL::SSL::SSLError

I am getting an OpenSSL::SSL::SSLError when I try to send an email via my contact form.
In my config/application.rb I have addded.
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "mail.vinderhimlen.dk",
:port => 587,
:user_name => "asd#vinderhimlen.dk",
:password => "x",
:authentication => :login
}
My form:
<%= simple_form_for [#support], :url => { :action => "create" }, :html => { :method => :post } do |f| %>
<%= f.input :sender_name, :label => 'Navn' %>
<%= f.input :email, :label => 'E-mail' %>
<%= f.input :support_type, :collection => ['Feedback', 'Idé', "Rapporter fejl", 'Business', 'Andet'], :prompt => "Valg type", :label => 'Erinde' %>
<%= f.label :Besked %>
<%= f.text_area :content, :label => 'Besked', :style => 'width:500px;', %>
<%= f.submit "submit", :value => 'Send besked' %>
<% end %>
My Supportscontroller:
class SupportsController < ApplicationController
def new
# id is required to deal with form
#support = Support.new(:id => 1)
end
def create
#support = Support.new(params[:support])
if #support.save
redirect_to('/', :notice => "Support was successfully sent.")
else
flash[:alert] = "You must fill all fields."
render 'new'
end
end
end
My Support model:
class Support
include ActiveModel::Validations
validates_presence_of :email, :sender_name, :support_type, :content
# to deal with form, you must have an id attribute
attr_accessor :id, :email, :sender_name, :support_type, :content
def initialize(attributes = {})
attributes.each do |key, value|
self.send("#{key}=", value)
end
#attributes = attributes
end
def read_attribute_for_validation(key)
#attributes[key]
end
def to_key
end
def save
if self.valid?
Notifier.support_notification(self).deliver
return true
end
return false
end
end
My config/enviroments/devolpment:
Konkurranceportalen::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
config.perform_delivery = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = true
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
end
My rails log on when submitting the form:
Started POST "/supports" for 127.0.0.1 at 2011-05-31 14:07:07 +0200
Processing by SupportsController#create as HTML
Parameters: {"utf8"=>"Ô£ô", "authenticity_token"=>"b4ILe7Xu4moToY8PN1X4wdyejz6
DQwnZ69FPevAWuSI=", "support"=>{"sender_name"=>"dfsdf", "email"=>"mail#freelance
rbasen.dk", "support_type"=>"Feedback", "content"=>"dsdsfsdfsdfsdfsdfsadasdasd"}
, "commit"=>"Send besked"}
←[1m←[36mSQL (0.0ms)←[0m ←[1mSELECT SUM(`tags`.`konkurrancers_count`) AS sum_
id FROM `tags`←[0m
←[1m←[35mSQL (10.0ms)←[0m describe `kategoris_konkurrancers`
←[1m←[36mKonkurrancer Load (0.0ms)←[0m ←[1mSELECT `konkurrancers`.* FROM `kon
kurrancers`←[0m
←[1m←[35mCACHE (0.0ms)←[0m SELECT `konkurrancers`.* FROM `konkurrancers`
←[1m←[36mTag Load (1.0ms)←[0m ←[1mSELECT `tags`.* FROM `tags`←[0m
Rendered notifier/support_notification.html.erb (1.0ms)
Sent mail to asd#vinderhimlen.dk (277ms)
Date: Tue, 31 May 2011 14:07:08 +0200
From: asd#freelancerbasen.dk
To: asd#vinderhimlen.dk
Message-ID: <4de4d9ecc67fdsfsdfsdf4ad#Home-Pc.mail>
Subject: New Feedback
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: quoted-printable
=EF=BB=BFhello world!
dsdsfsdfsdfsdfsdfsadasdasd=
Completed in 865ms
OpenSSL::SSL::SSLError (hostname was not match with the server certificate):
app/models/support.rb:24:in `save'
app/controllers/supports_controller.rb:9:in `create'
Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatc
h/middleware/templates/rescues/_trace.erb (1.0ms)
←[1m←[35mKonkurrancer Load (1.0ms)←[0m SELECT `konkurrancers`.* FROM `konkurr
ancers` LIMIT 15 OFFSET 0
←[1m←[36mSQL (4.0ms)←[0m ←[1mSHOW TABLES←[0m
←[1m←[35mSQL (5.0ms)←[0m SHOW TABLES
Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatc
h/middleware/templates/rescues/_request_and_response.erb (252.0ms)
Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatc
h/middleware/templates/rescues/diagnostics.erb within rescues/layout (318.0ms)
UPDATE:
In my config/application.rb:
config.action_mailer.smtp_settings = {:enable_starttls_auto => false }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "mail.vinderhimlen.dk",
:port => 587,
:user_name => "asd#vinderhimlen.dk",
:password => "x",
:authentication => :login,
:domain => "vinderhimlen.dk",
:enable_starttls_auto => false
}
You could try
:openssl_verify_mode => 'none'
per Undocumented ActionMailer openssl_verify_mode option

Resources