Results 1 to 11 of 11

Thread: hostname was not match with the server certificate


View Newest Posts

  1. #1
    unknown888 is offline Forum Member
    Join Date
    Mar 2008
    Posts
    56

    Default hostname was not match with the server certificate

    Hi, I am setting up a rails application and when I deliver an email, i get this

    OpenSSL::SSL::SSLError in UsersController#forgot_password

    hostname was not match with the server certificate

    here is my setting

    ActionMailer::Base.raise_delivery_errors = true
    ActionMailer::Base.perform_deliveries = true
    ActionMailer::Base.delivery_method = :smtp

    ActionMailer::Base.smtp_settings = {
    :address => "localhost",
    :port => 25,
    :domain => "domain.com",
    :user_name => "user@domain.com",
    :password => "pass",
    :authentication => :login
    }

    by not using any of the settings, only using sendmail, i am able to receive emails but its "From: " is not having proper domain.com ( it has the server name i have set in cpanel). Any help is much appreciated.

  2. #2
    NickJ is offline Chief Technical Officer
    Join Date
    Jun 2007
    Posts
    320

    Default

    Hello,

    Its not a error rather a warning message as SSL is hostname based.
    If you are using secure connection then you will need to use the SMTP server as servers's hostname i.e the actual hostname of server on which your domain is hosted. Also, secure SMTP port would be 465.

    Regards,
    NicK J.

  3. #3
    jennifer is offline Moderator (eUKhost.com)
    Join Date
    Mar 2009
    Posts
    406

    Default

    Hi,

    With the new versions of rails you now have to use the server’s host name as set in SSL certificate rather than using localhost I guess. Just as you have it here:

    :address => "localhost",

    Make sure to point your ActionMailer settings to use the server’s host name as set in the server’s SSL certificate.

    :address => ’server.ssl.name’,

    while I cannot assure if this is a quick fix to it, but worth a try

    Let me know how you get on it.

  4. #4
    unknown888 is offline Forum Member
    Join Date
    Mar 2008
    Posts
    56

    Default

    jennifer

    I never had a ssl in my vps.

    thanks

  5. #5
    jennifer is offline Moderator (eUKhost.com)
    Join Date
    Mar 2009
    Posts
    406

    Default

    Did you try replacing it with the server hostname or your domain name rather than using localhost?

  6. #6
    unknown888 is offline Forum Member
    Join Date
    Mar 2008
    Posts
    56

    Default

    Quote Originally Posted by jennifer View Post
    Did you try replacing it with the server hostname or your domain name rather than using localhost?
    I did try but it did not work. May be I have to install smtp-tls gem.?.

  7. #7
    AlexP's Avatar
    AlexP is offline Senior System Administrator
    Join Date
    Apr 2007
    Posts
    462

    Default

    Hello,

    The problem is that enable_starttls_auto comes true by default so you will have to disable it, Please add following line in config.action_mailer.smtp_settings =

    :enable_starttls_auto => false
    Let me know if still you have a problem so I will check it further.
    Thanks and Regards,
    Alex Parker
    Senior System Administrator.
    Dedicated Hosting || Semi Dedicated Hosting|Disaster Recovery Solutions

    EMAIL:alex @ eukhost.com
    MSN: alex @ eukhost.com
    SKYPE: euk_alexp

  8. #8
    unknown888 is offline Forum Member
    Join Date
    Mar 2008
    Posts
    56

    Default

    Quote Originally Posted by AlexP View Post
    Hello,

    The problem is that enable_starttls_auto comes true by default so you will have to disable it, Please add following line in config.action_mailer.smtp_settings =



    Let me know if still you have a problem so I will check it further.
    Alex, I tried that bit but rails threw an error as this setting is not recognised in rails 2.2.2. So, i had to hack action mailer. Now it works as expected.

    Thanks everyone for offering help.

  9. #9
    jennifer is offline Moderator (eUKhost.com)
    Join Date
    Mar 2009
    Posts
    406

    Default

    Is there anyway you could post here what are the exact changes you made to get it working? It would be good to know the fix for the next time

    Thanks!

  10. #10
    unknown888 is offline Forum Member
    Join Date
    Mar 2008
    Posts
    56

    Default

    Absolutely Jenni

    Open up the base.rb in ActionMailer and comment the following line:

    smtp.enable_starttls_auto if smtp.respond_to?(:enable_starttls_auto)

    for me, he was the troublemaker, so had to sort him with a #

    cheers

  11. #11
    jennifer is offline Moderator (eUKhost.com)
    Join Date
    Mar 2009
    Posts
    406

    Default

    aah thanks for posting the quick fix.

    Alex was almost there... the trick is basically to turn off TLS with the current running mail server. So adding a code to disable it or commenting the enable_starttls line either should do to get this working..

    Thank you for posting the fix.. much appreciated

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Disclaimer of Liability

The opinions or views posted on our forum by users do not necessarily represent the opinions or views of eUKhost Limited.

Our forum may contain hyperlinks to external websites not under our control and ownership. We do not endorse the content found on any external websites and we cannot guarantee the accuracy, reliability, availability and suitability of such websites and the content of those websites. Your access and use of any external websites is at your sole risk and responsibility. Please also be aware external websites will have differing terms and conditions, privacy and cookie usage policies to our website.