From: Cliff Rosson Date: 2013-05-30T02:19:48+09:00 Subject: Re: sending a gmail using ruby --047d7b41b7eca6fec604ddde9675 Content-Type: text/plain; charset=ISO-8859-1 Try connecting first. That works for me. require 'highline/import' require 'gmail' password = ask("Password: ") { |q| q.echo = "*" } @gmail = Gmail.connect("cliff.rosson@gmail.com", password) email = @gmail.compose do to "cliff.rosson@gmail.com" subject "blah blah blah" body "blah blah blah" end @gmail.deliver(email) @gmail.logout On Wed, May 29, 2013 at 9:55 AM, David Munyaka wrote: > 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(username@gmail.com, password) > > gmail.deliver do > to "username@gmail.com" > 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 > > -- > Posted via http://www.ruby-forum.com/. > > -- vizualize.me/cliffrosson --047d7b41b7eca6fec604ddde9675 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Try connecting first. That works for me.
<= div>
require 'highline/import'
require '= ;gmail'

password =3D ask("Password: "= ;) { |q| q.echo =3D "*" }

@gmail =3D Gmail.connect("cliff.rosson@gmail.com", password)

email =3D @gmail.compose do
=A0 =A0 to= "cliff.rosson@gmail.com= "
=A0 =A0 subject "blah blah blah"
=A0 =A0 body &quo= t;blah blah blah"
=A0 end

@gm= ail.deliver(email)
@gmail.logout


On Wed, May 29, 2013 at 9:55 AM, David M= unyaka <lists@ruby-forum.com> wrote:
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'
=A0gmail =3D Gmail.new(username@gmail= .com, password)

=A0gmail.deliver do
=A0 to "username@gmail.com&q= uot;
=A0 subject "Not feeling well"
=A0 text_part do
=A0 =A0 body "I won't be coming in today."
=A0 end
=A0 html_part do
=A0 =A0 body "<p>I <em>won't</em> be coming in t= oday.</p>"
=A0 end
end

gmail.logout

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




--
vizual= ize.me/cliffrosson
--047d7b41b7eca6fec604ddde9675--