Rails SSL::SSLError when trying to submit email to Mailchimp via Gibbon

172 views Asked by At

Controller:

def subscribe
@list_id = "01d4743206"
@gb = Gibbon::API.new
@gb.lists.subscribe({:id => @list_id, :email => {:email => '[email protected]'}, :merge_vars => {:FNAME => 'First Name', :LNAME => 'Last Name'}, :double_optin => false})
end

Gibbon.rb initializer:

Gibbon::API.api_key = "5dbfa9b02dd8a28aa43937d19855da6e-us9"
Gibbon::API.timeout = 15
Gibbon::API.throws_exceptions = false

View:

<%= form_tag('/posts/subscribe', method: "post", id: "subscribe", remote: "true") do %>

<%= email_field(:email, :address, {id: "mailersub", placeholder: "Enter your email"}) %>


<%= submit_tag("Submit", id: "mailersubmit") %>

<% end %>

Routes:

post 'posts/subscribe' => 'posts#subscribe'

Error:

Started POST "/posts/subscribe" for 127.0.0.1 at 2014-11-25 10:26:23 +0000
Processing by PostsController#subscribe as JS
Parameters: {"utf8"=>"✓", "email"=>{"address"=>"[email protected]"}, "commit"=>"Submit"}
Completed 500 Internal Server Error in 92ms

OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed):
app/controllers/posts_controller.rb:11:in `subscribe'

Any advice as to how I would go about fixing this would be greatly appreciated, not sure why this issue is arising as I seem to be using Gibbon the same way a lot of others do.

Thanks.

0

There are 0 answers