Hello ,
I been trying to send email in rails 3 and it happen that I
thought of trying in console and found that mail are not been sent and
the ruby code always result in error like
post_connection_check'': hostname was not match with the server
certificate (OpenSSL::SSL::SSLError)
then i thought of reverting to actionmailer 2.3.5 and run the same code
lucky it work with no error
Here my both code
1. Code in Action Mailer 3
require "rubygems"
require "action_mailer"
require "ruby-debug"
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "127.0.0.1",
:port => 25,
:domain => ''ubuntu.ubuntu.com'',
:authentication => :plain
}
class Notifier < ActionMailer::Base
default :from => "sender_email_id"
# Send reset password notification to user.
def password_reset_mail(user)
subject "Password Reset Instructions"
from "sender_email_id-J0of1frlU80@public.gmane.org"
recipients user
content_type "text/html"
sent_on Time.now
body "RESET your Password"
end
end
mail_recipient = ''receiver_email_id''
Notifier.password_reset_mail(mail_recipient).deliver
2 . Code in ActionMailer 2.3.5
require "rubygems"
gem ''actionmailer'',''=2.3.5''
require "actionmailer"
require "ruby-debug"
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "127.0.0.1",
:port => 25,
:domain => ''ubuntu.ubuntu.com'',
:authentication => :plain
}
class Notifier < ActionMailer::Base
def password_rest_mail(user)
subject "Password Reset Instructions"
from "sender_email_id-J0of1frlU80@public.gmane.org"
recipients user
content_type "text/html"
sent_on Time.now
body "RESET your Password"
end
end
end
mail_recipient = ''receiver_email_id''
Notifier.deliver_password_rest_mail(mail_recipient)
Any Idea Why is the so
Thanks
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.