Mailchimp or alternatives

34 views
Skip to first unread message

Travis Mr.

unread,
Jul 21, 2015, 12:15:09 PM7/21/15
to rubyonra...@googlegroups.com
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.

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.

--
Posted via http://www.ruby-forum.com/.

Scott Ribe

unread,
Jul 21, 2015, 12:34:17 PM7/21/15
to rubyonra...@googlegroups.com
On Jul 21, 2015, at 10:13 AM, Travis Mr. <li...@ruby-forum.com> 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 Ribe
scott...@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice





Travis Eubanks

unread,
Jul 21, 2015, 8:18:32 PM7/21/15
to rubyonra...@googlegroups.com
Scott Ribe wrote in post #1176728:
> On Jul 21, 2015, at 10:13 AM, Travis Mr. <li...@ruby-forum.com> 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"=>"teub...@tutelaholding.com"}, "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--------

<div class="landing-box">
<div class="call-action">
<h1>Free weekly Ab Workouts!</h1>
<h4>This isnt your typcal Richard Simmons routine.</h4>

<%= 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 %>
</div>
<div class="col-md-8 col-md-offset-2">
<div class="final-word">
<p>Stop <i>GUESSING</i> what to do by getting weekly guides on
affective routines! Just type in your email and recieve a weekly ab
routine totally free!</p>
</div>
</div>
</div>

Travis Eubanks

unread,
Jul 21, 2015, 8:20:10 PM7/21/15
to rubyonra...@googlegroups.com
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

Scott Ribe

unread,
Jul 21, 2015, 8:31:00 PM7/21/15
to rubyonra...@googlegroups.com, Travis Eubanks
On Jul 21, 2015, at 6:17 PM, Travis Eubanks <li...@ruby-forum.com> 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.

Travis Eubanks

unread,
Jul 22, 2015, 6:57:42 AM7/22/15
to rubyonra...@googlegroups.com
Scott Ribe wrote in post #1176738:
> On Jul 21, 2015, at 6:17 PM, Travis Eubanks <li...@ruby-forum.com>
> 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!

Colin Law

unread,
Jul 22, 2015, 2:16:09 PM7/22/15
to rubyonra...@googlegroups.com
Perhaps I don't understand the line above, but you appear to be
passing the string 'address' as the address.
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2200e3073d5b19c3a6339fd3ee2c9385%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages