1

理由はわかりませんが、メールが Mailchimp リストに渡されません。送信ボタンをクリックしても何も起こりません。何かご意見は?

Gemfile:

gem 'gibbon', '~> 1.0.0'

index.html.erb:

<%= form_tag('/welcome/subscribe', method: "post", id: "subscribe", remote: "true") do -%>
   <%= email_field(:email, :address, {id: "email", placeholder: "email address", :class=>"email form-control"}) %>
   <%= submit_tag("Sign me up!", :class=>"btn btn-palette") %>
<% end %>

モデル/welcome.rb:

def subscribe

@list_id = "my list id is in here"
gb = Gibbon::API.new

gb.lists.subscribe({
  double_opt_in: false,
  :id => @list_id,
  :email => {:email => params[:email][:address]}
  })
end

初期化子/ギボン.rb:

Gibbon::API.api_key = "my api key is in here"
Gibbon::API.timeout = 15
Gibbon::API.throws_exceptions = false

ルート.rb:

post 'welcome/subscribe' => 'welcome#subscribe'
  root 'welcome#index'

コントローラー/welcome_controller.rb:

class WelcomeController < ApplicationController
  def index
  end

  def subscribe

    @list_id = "my list id is in here"
    gb = Gibbon::API.new

    gb.lists.subscribe({
      double_opt_in: false,
      :id => @list_id,
      :email => {:email => params[:email][:address]}
      })
    end
  end
4

1 に答える 1

0

このコードで解決しました: Mailchimp gem double_optin false not working

しかし、ダブルオプトインに問題がある => false

于 2016-01-31T17:43:42.437 に答える