Mailchimp or alternatives


#1

Im currently trying to just build a simple splash page that has one
input field for a form which is their email.

Im trying to use the Mailchimp and gibbon gem. When im on my localhost
and try to input my email and submit it… nothing happens. I get an
error in my terminal saying 500 error, email must contain one ‘@’…

WHICH it does contain only one.

Not sure why that error is being thrown.

My main goal is to just simple take a visitors email address they
inputed and send it to my mailchimp account for future mass emailing to
all that have signed up with me.


#2

On Jul 21, 2015, at 10:13 AM, Travis Mr. removed_email_address@domain.invalid wrote:

I guess what I’m trying to figure out is… without any tables or
models can I take in a users email address and sent it to my mailchimp
account for future email marketing for my info.

Yes, you can do that, no problem.

You probably need to back up and provide us more info about what you’re
doing and the exact error message.


Scott R.
removed_email_address@domain.invalid
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice


#3

Scott R. wrote in post #1176728:

On Jul 21, 2015, at 10:13 AM, Travis Mr. removed_email_address@domain.invalid wrote:

I guess what I’m trying to figure out is… without any tables or
models can I take in a users email address and sent it to my mailchimp
account for future email marketing for my info.

Yes, you can do that, no problem.

You probably need to back up and provide us more info about what you’re
doing and the exact error message.

When I hit submit with my valid email address I get this error response
in my terminal

Started POST “/emailapi/subscribe” for ::1 at 2015-07-21 19:10:28 -0500
Processing by EmailapisController#subscribe as JS
Parameters: {“utf8”=>“✓”,
“email”=>{“address”=>“removed_email_address@domain.invalid”}, “commit”=>“Sign me
up for the abs!”}
Completed 500 Internal Server Error in 2490ms (ActiveRecord: 0.0ms)

Gibbon::MailChimpError (An email address must contain a single @):
app/controllers/emailapis_controller.rb:8:in `subscribe’

-------CONTROLLER--------

class EmailapisController < ApplicationController
def index
end

def subscribe
gb = Gibbon::API.new(ENV[‘mailchimp_key’])

gb.lists.subscribe({:id => ENV['mailchimp_id'],
  :email => {:email =>'address'}
  })

end
end

-------VIEW--------

Free weekly Ab Workouts!

This isnt your typcal Richard Simmons routine.

<%= form_tag('/emailapi/subscribe', method: "post", id: "subscribe", 

remote: “true”) do %>
<%= email_field(:email, :address, {id: “email”, placeholder: “email
address”}) %>
<%= submit_tag(“Sign me up for the abs!”, :class => “btn
btn-success”) %>
<% end %>

Stop GUESSING what to do by getting weekly guides on affective routines! Just type in your email and recieve a weekly ab routine totally free!


#4

On Jul 21, 2015, at 6:17 PM, Travis E. removed_email_address@domain.invalid
wrote:

gb.lists.subscribe({:id => ENV[‘mailchimp_id’],
:email => {:email =>‘address’}
})

While I know nothing about that gem you’re using, I suspect that it does
not take a key and then use it to access params. So you’re in effect
trying to sign up with an address that is literally the string
‘address’. Where the email address you obviously want to send to
MailChimp is in params[:email][:address].

I’d also question whether the gem really wants an argument of the form
:email => {:email => …}, but I don’t know that’s wrong–something else
for you to check.


#5

I totally feel that I’m missing some major but simple things here. When
i submit the email address the site has NO visual errors just errors
shown are the ones in the terminal stated above


#6

Scott R. wrote in post #1176738:

On Jul 21, 2015, at 6:17 PM, Travis E. removed_email_address@domain.invalid
wrote:

While I know nothing about that gem you’re using, I suspect that it does
not take a key and then use it to access params. So you’re in effect
trying to sign up with an address that is literally the string
‘address’. Where the email address you obviously want to send to
MailChimp is in params[:email][:address].

This was it! I was sending in literally the string ‘address’ when i
needed to send in the params[:email][:address]

Thank for the help Scott!


#7

On 22 July 2015 at 01:17, Travis E. removed_email_address@domain.invalid wrote:

doing and the exact error message.
Completed 500 Internal Server Error in 2490ms (ActiveRecord: 0.0ms)

def subscribe
gb = Gibbon::API.new(ENV[‘mailchimp_key’])

gb.lists.subscribe({:id => ENV['mailchimp_id'],
  :email => {:email =>'address'}

Perhaps I don’t understand the line above, but you appear to be
passing the string ‘address’ as the address.