Sending a gmail using ruby

please help analyzing this code and please give me some recommendations.
I am trying to send an email from one gmail account to another. The
first error I am getting is that my password for my gmail is not being
accepted by the code. Please offer a solution to this or point me to a
code that has worked for you in sending gmail.

I have installed the gmail gem. I am using ruby 2.0.0p195

the code I am using is:

require ‘gmail’
gmail = Gmail.new([email protected], password)

gmail.deliver do
to “[email protected]
subject “Not feeling well”
text_part do
body “I won’t be coming in today.”
end
html_part do
body “

I won’t be coming in today.


end
end

gmail.logout

Try connecting first. That works for me.

require ‘highline/import’
require ‘gmail’

password = ask("Password: ") { |q| q.echo = “*” }

@gmail = Gmail.connect(“[email protected]”, password)

email = @gmail.compose do
to “[email protected]
subject “blah blah blah”
body “blah blah blah”
end

@gmail.deliver(email)
@gmail.logout

thanks but it seems like you have a different version of Ruby because I
am getting an error :in ‘’: Undefined method ‘connect’ for
Gmail:Class

I am using the code that you provided. Any ideas?

Huh. It doesn’t work for me in 2.0.0 but I don’t get the same error as
you.
My Gmail does have the connect method.

2.0.0p0 :001 > require ‘gmail’
=> true
2.0.0p0 :002 > Gmail.respond_to?(“connect”)
=> true
2.0.0p0 :003 >

Instead I get the following error when I try to connect
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read
server key exchange B: bad ecpoint
from
/Users/cliff.rosson/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/imap.rb:1454:in
connect' from /Users/cliff.rosson/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/imap.rb:1454:instart_tls_session’
from
/Users/cliff.rosson/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/imap.rb:1047:in
initialize' from /Users/cliff.rosson/.rvm/gems/ruby-2.0.0-p0/gems/gmail-0.4.0/lib/gmail/client/base.rb:26:innew’
from
/Users/cliff.rosson/.rvm/gems/ruby-2.0.0-p0/gems/gmail-0.4.0/lib/gmail/client/base.rb:26:in
connect' from /Users/cliff.rosson/.rvm/gems/ruby-2.0.0-p0/gems/gmail-0.4.0/lib/gmail.rb:49:innew’
from (irb):4
from /Users/cliff.rosson/.rvm/rubies/ruby-2.0.0-p0/bin/irb:16:in
`’

yeah, I will let you know if I figure out something helpful

Do you have highline and import installed?

The ask method wouldn’t work for me without the highline gem. Maybe the
connect method comes from another gem?

On May 29, 2013, at 6:55 PM, David M. [email protected] wrote:

installed the gmail gem

Out of curiosity why bother with such ‘gmail’ gem? After all, Gmail is
just SMTP for sending and IMAP/POP for retrieving emails. Like every
other email systems in the world.

So what’s special about ‘sending a gmail’? What about just ‘sending an
email’?

James Michiemo wrote in post #1110554:

Do you have highline and import installed?

The ask method wouldn’t work for me without the highline gem. Maybe the
connect method comes from another gem?

not sure but that may be a possibility. I am pretty new to Ruby

I send automated emails from a gmail account occasionally, using the
‘mail’ gem.

This link was quite helpful in setting it up:

Can you please unsubscribe me? I keep getting this damn spam…

Can you please unsubscribe me? I keep getting this damn spam…

Petite A. wrote in post #1110557:

On May 29, 2013, at 6:55 PM, David M. [email protected] wrote:

installed the gmail gem

Out of curiosity why bother with such ‘gmail’ gem? After all, Gmail is
just SMTP for sending and IMAP/POP for retrieving emails. Like every
other email systems in the world.

So what’s special about ‘sending a gmail’? What about just ‘sending an
email’?

all I really want to do is send an email. It just happened that I was
using gmail.

Dumb question is dumb.

Can you please unsubscribe me? I keep getting this damn spam…

From: James Michiemo [mailto:[email protected]]
Sent: Wednesday, May 29, 2013 11:52 AM
To: ruby-talk ML
Subject: Re: sending a gmail using ruby

Do you have highline and import installed?

The ask method wouldn’t work for me without the highline gem. Maybe the
connect method comes from another gem?

On Wed, May 29, 2013 at 1:41 PM, David M. [email protected]
wrote:

thanks but it seems like you have a different version of Ruby because I
am getting an error :in ‘’: Undefined method ‘connect’ for
Gmail:Class

I am using the code that you provided. Any ideas?

Unless your IQ is over 200 that sounds like an easy $50. Now stop
hijacking threads.

Not really. There are several people who can’t unsubscribe and are
trying
to, right now. The instructions do not work.

By the way, I’ll bet you $50 bucks that my IQ is 50 points higher than
yours. lol

From: Cliff R. [mailto:[email protected]]
Sent: Wednesday, May 29, 2013 2:01 PM
To: ruby-talk ML
Subject: Re: sending a gmail using ruby

Dumb question is dumb.

On Wed, May 29, 2013 at 1:28 PM, Nicholas M. [email protected]
wrote:

Can you please unsubscribe me? I keep getting this damn spam…

From: James Michiemo [mailto:[email protected]]
Sent: Wednesday, May 29, 2013 11:52 AM

To: ruby-talk ML
Subject: Re: sending a gmail using ruby

Do you have highline and import installed?

The ask method wouldn’t work for me without the highline gem. Maybe the
connect method comes from another gem?

On Wed, May 29, 2013 at 1:41 PM, David M. [email protected]
wrote:

thanks but it seems like you have a different version of Ruby because I
am getting an error :in ‘’: Undefined method ‘connect’ for
Gmail:Class

I am using the code that you provided. Any ideas?


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

On May 29, 2013, at 14:19 , Nicholas M. [email protected] wrote:

Not really. There are several people who cant unsubscribe and are trying to,
right now. The instructions do not work.

Yes, they do. As demonstrated by several people over the years.

By the way, Ill bet you $50 bucks that my IQ is 50 points higher than yours lol

Wow. You really are an amazing douche. Keep up the good work.

215

That claim requires independent documented proof, otherwise, you’re
just another dog on the internet like us.

On May 29, 2013, at 15:34 , Ryan D. [email protected] wrote:

On May 29, 2013, at 14:19 , Nicholas M. [email protected] wrote:

Not really. There are several people who cant unsubscribe and are trying to,
right now. The instructions do not work.

Yes, they do. As demonstrated by several people over the years.

Oh look! It works fine!

unsubscribe-confirm 201305300736321631415926 ryand-ruby zenspider.com
set UNSUBSCRIBE-CONFIRM => BYE
BYE [[email protected]] accepted.
change member and recipient lists