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
nyaks
May 29, 2013, 7:20pm
2
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
nyaks
May 29, 2013, 7:41pm
3
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?
nyaks
May 29, 2013, 8:24pm
4
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:in
start_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:in
new’
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:in
new’
from (irb):4
from /Users/cliff.rosson/.rvm/rubies/ruby-2.0.0-p0/bin/irb:16:in
`’
nyaks
May 29, 2013, 8:31pm
5
yeah, I will let you know if I figure out something helpful
nyaks
May 29, 2013, 8:52pm
6
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?
nyaks
May 29, 2013, 9:00pm
7
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’?
nyaks
May 29, 2013, 9:20pm
8
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
nyaks
May 29, 2013, 9:54pm
9
I send automated emails from a gmail account occasionally, using the
‘mail’ gem.
This link was quite helpful in setting it up:
require 'rubygems' require 'mail' # Set up delivery defaults to use Gmail Mail.defaults do delivery_method :smtp, { :address => 'smtp.gmail.com', :port => '587', :user_name => '@gmail.com', :password => '', ...
nyaks
May 29, 2013, 10:28pm
10
Can you please unsubscribe me? I keep getting this damn spam…
nyaks
May 29, 2013, 10:31pm
11
Can you please unsubscribe me? I keep getting this damn spam…
nyaks
May 29, 2013, 9:25pm
12
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.
nyaks
May 29, 2013, 10:32pm
14
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?
nyaks
May 29, 2013, 11:46pm
15
Unless your IQ is over 200 that sounds like an easy $50. Now stop
hijacking threads.
nyaks
May 29, 2013, 11:20pm
16
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/ .
–
nyaks
May 30, 2013, 12:35am
17
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.
nyaks
May 30, 2013, 12:39am
19
That claim requires independent documented proof, otherwise, you’re
just another dog on the internet like us.
nyaks
May 30, 2013, 12:42am
20
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