Git Product home page Git Product logo

gmail's People

Contributors

abhishiv avatar alexgenco avatar awakia avatar bb avatar beam avatar bootstraponline avatar github0013 avatar iamwilhelm avatar jeffcarbs avatar jgrevich avatar joelparkerhenderson avatar johnnyshields avatar kieranp avatar kitlangton avatar kuboon avatar lcpriest avatar markgandolfo avatar mikker avatar namxam avatar nu7hatch avatar radar avatar rjain11 avatar rtlong avatar rustynail avatar ryanlchan avatar slash4 avatar tcaddy avatar unkrich avatar webcracy avatar yn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gmail's Issues

Saving Attachments

From @GZhou on November 27, 2010 5:55

Please excuse me if there's an obvious answer to this as i'm new to rails and github, but I can't seem to find the save_attachments_to method...

Also it seems that the "message" method is private so the attachments saving function isn't implemented in the most recent version of this - correct?

Thanks so much for putting this together and for your help.

Copied from original issue: nu7hatch/gmail#14

NoMethodError: undefined method `stringify_keys!'

From @danijel on September 30, 2011 19:31

Hello, I have this problem popping up when I try to get message body.
I was able to track it down to message method in message.rb
def message
@message ||= Mail.new(@gmail.mailbox(@mailbox.name) {
@gmail.conn.uid_fetch(uid, "RFC822")[0].attr["RFC822"] # RFC822
})
end

It looks like Mail.new is throwing this error.
fetch returns message body string and Mail.new throws the error.
Any ideas?

Btw. I'm running this on rails 2.3.10, I have these gems installed

mail (2.3.0, 2.2.5)
mime (0.1)
mime-types (1.16)

Copied from original issue: nu7hatch/gmail#42

Crazy memory usage when getting attachments

From @cannikin on July 8, 2011 4:51

Hi there,

Loving the gem, but found some runaway memory usage when getting attachments to an email...the problem may actually be with the Mail gem itself, but figured I start here. I've got a gist below with the simplest code I could write that shows the problem.

I output memory usage after each step (getting unread emails from the inbox, looping through each found email, calling attachments on the email:

START 17.32 MB
  Gmail initialized 17.67 MB
  retrieve inbox 20.43 MB
    email 0: about to read 20.44 MB
    message read 46.55 MB
END 46.55 MB

As I loop though those emails and retrieve the attachments I never get the memory back. :( Here's the script that I'm using: https://gist.github.com/1071169 You'll need to be running Ruby 1.8.7 to use memprof and see all the objects that Ruby is still hanging onto at the end of the script (and it's a LOT, thousands and thousands).

I've tried saving the attachments to disk thinking maybe that'll release the memory, but no luck. Any ideas?

Thanks for any help!
Rob

Copied from original issue: nu7hatch/gmail#29

Track some emails

From @VizirAdmin on May 17, 2011 6:18

Hi,

I'm using gmail gem to send emails and I need track these emails. How can I do this?

I'm trying search the email with the message_id, but it bring all emails from my inbox and I want just the responses of a specific email.

Here is my actual code:

    #save email with the message_id
    ...
    mail = gmail.deliver(email)
    Email.create(:message_id => mail.message_id, :from => user.email,
      :to => annotation.to, :body => annotation.content, :title => annotation.title,
      :annotation => annotation, :user => user)
    #search the mails with message_id
    messages = gmail.inbox.mails(:message_id => email.message_id)

Regards,

Fabrício Ferrari de Campos

Copied from original issue: nu7hatch/gmail#25

Support for 2 legged OAuth plus minor clean ups and fixes

From @nikosd on August 31, 2011 9:0

Hello there,

Since the gmail_xoauth has support for 2 legged authentication I believe the gmail gem should support it too :)

I couldn't think of way to write actual integration tests but I added some mocked ones and have already tested it on live production code and it seems to be working ok.

Review it and let me know if you have any objections / ideas / etc...

Copied from original issue: nu7hatch/gmail/pull/35

Gmail::Message has hard coded label names

From @github0013 on September 29, 2011 2:41

gmail has its own special label names such as

"[Gmail]/All Mail",
"[Gmail]/Drafts",
"[Gmail]/Important",
"[Gmail]/Sent Mail",
"[Gmail]/Spam",
"[Gmail]/Starred",
"[Gmail]/Trash"

but these are translated in other language if the gmail language setting is not English.

For an instance, if I set it to Japanese, the labels are listed as below.
*the labels you create will not be affected under in any language setting

"[Gmail]/すべてのメール",
"[Gmail]/ゴミ箱",
"[Gmail]/スター付き",
"[Gmail]/下書き",
"[Gmail]/迷惑メール",
"[Gmail]/送信済みメール",
"[Gmail]/重要"

I am currently using gmail in English to avoid this problem, but could there be a way to add a method to configure this language setting?

Copied from original issue: nu7hatch/gmail#41

this reduces mailbox switching and fixes the Rakefile for 1.9.2

From @aub on August 16, 2011 16:12

  • In Gmail::Client::Base#mailbox there was a test in one place to make sure the mailbox wasn't switched to the same one it's already on, but that wasn't happening for the block version. I modified switch_to_mailbox so the test is done there.
  • I then had a problem with threading and fixed it by adding the line described here: https://github.com/saranyan/gmail/commit/1bb109390bb47c881e7f8c34b6f3dc4ec6927da2
  • Then, I couldn't build the gem with 1.9, so I had to require psych in the Rakefile and add some quotes to gemspec.yml

sorry about the whitespace changes in base.rb. the only actual changes are around lines 20, 157, and 199.

Copied from original issue: nu7hatch/gmail/pull/33

does this work with 1.9.2

From @rkumar on October 25, 2010 15:16

ruby-1.9.2-head > Gmail.connect("[email protected]","xxx") do |gmail|
ruby-1.9.2-head > gmail.inbox.count
ruby-1.9.2-head ?> end
Net::IMAP::BadResponseError: Unknown command z5if11396491vco.62

and

ruby-1.9.2-head > gmail = Gmail.connect!("[email protected]","xxxxx")
NoMethodError: undefined method `data' for "Couldn't login to given GMail account: [email protected]

(I am on a macosx snow leopard, using rvm 1.9.2)

Copied from original issue: nu7hatch/gmail#1

Implemented gmail.fetch, message.read? and message.starred?

From @Waseems on June 15, 2011 11:29

Hi,

I have implemented the imap fetch command for range based navigation of the gmail inbox, additionally I have also implemented the read? and starred? flags on the message class.

You might want to be a bit selective about pulling in my changes because I have also for example removed the mailbox locking login for no other reason that it made my application a bit harder to code.

Unfortunately I have not been able to write proper tests because I am assuming that your tests run against a specific mailbox with specific data, as a lot of tests were failing using a clean clone of your repository.

I hope there is something useful in my commits and apologies if I have saddled you up with to much merge hastle :-)

Regards,

Waseem

Copied from original issue: nu7hatch/gmail/pull/27

label colors

From @krusty on July 28, 2011 15:56

Hi, first of all thanks for this great gem. Is there a way to set label colors? does the API even allow this?

Copied from original issue: nu7hatch/gmail#32

.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/openssl/buffering.rb:36: [BUG] Segmentation fault

From @heaven on January 3, 2012 14:3

Have this problem when trying to use the gem: http://pastebin.com/H9ig0E7P
Not sure if this is a gem problem but perhaps someone know how to fix this issue? Used ruby 1.9.2-p290 patched for faster rails startup.

Fault happens when trying client.logout/inbox, but Gmail.connect(Settings.gmail.username, Settings.gmail.password) works properly.

System is linux x86_64.

Best,
Alex

Copied from original issue: nu7hatch/gmail#46

determining starred emails in a mailbox

From @rkumar on October 31, 2010 12:47

Am i missing some simple way of knowing which emails are starred so i can display accordingly.

So I retrieved those with label "[GMAIL]/Starred" and put their UID's in an array, so i could match UIDs with those in INBOX. However, the same email has a different UID in Starred Label and INBOX label !!!

(I starred the email on the web gmail interface, so i know its the same email).

I am sorry if i am spamming you with these queries since they are not relating to your gem. Any thoughts/tips would be welcome.

Copied from original issue: nu7hatch/gmail#7

email.delete! moves to All Mail instead of Trash

From @jerodsanto on October 31, 2010 22:36

Just tested email.delete! and it flags as deleted, which Gmail seems to use to archive (All Mail) instead of delete (Trash).

I tried to work around this by adding the '[Gmail]/Trash" label and then flagging as deleted, but that seems to put it in the trash and leave it in the inbox. Very strange.

Copied from original issue: nu7hatch/gmail#8

Small fixes...

From @ducngtuan on February 23, 2011 0:28

Because the last time the change was so big, some small fix cannot be applied. So I make this branch just for it.

  1. For Ruby 1.9.2, Net::IMAP::NoResponseError#new take a Net::IMAP::TaggedResponse object as argument, the error description will be put in a Net::IMAP::ResponseText. A NoMethodError would be raised for the old code.
  2. For me conn.list('[Gmail]/', '%') will return nil, then an error would be raised since we cannot + nil.

Copied from original issue: nu7hatch/gmail/pull/21

Is there a way to retreive sent emails ?

From @slash4 on September 9, 2011 17:30

hello,

I need to do something, that I couldnt find until now. Is it possible to gather "sent" emails from Gmail ? I'm trying to reproduce the "is:sent" filter in standard Gmail search.

I've tried many things, like mailbox('sent'), gmail.sent.mails, mailbox('is:sent')... And if we search as usual : gmail.inbox.search("doe"), it doesnt fetch the sent mail.

Thanks a lot,

Alex

Copied from original issue: nu7hatch/gmail#38

email#message undefined method

From @jShaf on October 26, 2010 13:49

I could run this:

gmail.inbox.emails(:unread).each {|e| p e.subject}

but not this:

gmail.inbox.emails(:unread).each {|e| p e.message}
NoMethodError: undefined method `message' for #Mail::Message:0x00000102cdc578

Good work, btw!

Copied from original issue: nu7hatch/gmail#2

how to unpack ?

From @rkumar on October 28, 2010 9:46

Can you give me any tips about unpacking. Some email bodies say use "munpack". Although, i can save the body and run munpack, is there anyway to determine at time of mail.body that unpack is required.

Is there some routine in gmail gem or mail gem that does the unpacking?
Thanks a lot.

Copied from original issue: nu7hatch/gmail#4

Gmail Message ID

From @jnarowski on October 19, 2011 19:50

Do you ever plan to add support for searching by message_id? This is not the email thread id, but the the Gmail frontend message id of the message (this is a 64-bit hexadecimal value, different from the RFC 822 Message-ID).

This is provided to Google Apps and contextual gadgets, and the message can be retrieved using this ID as follows:
http://code.google.com/apis/gmail/imap/#x-gm-msgid

I am not sure if the Ruby IMAP library supports it or what would be necessary to add it, but if this could be added that would be awesome.

Copied from original issue: nu7hatch/gmail#43

Fix for add_label, encoding-awareness for labels

From @bb on November 21, 2010 21:36

Hi,

the first one is easy: add_label was not doing what the name suggested.

The second one is tough and needs a good review: Labels were outputted utf-7 to the user which is not a good idea, IMHO. I added the standard conversion methods at all places that I saw fitting - hopefully I didn't miss any. So: please review carefully.

I'm just seeing that two older commits are also in this pull request, I hope you don't mind :)

Copied from original issue: nu7hatch/gmail/pull/13

Best way to read the message.body

From @miguelgraz on November 12, 2011 2:16

Hi, I recently used the gem and needed to interpret the real text of the message, I could do it with this code:

gmail.inbox.find(:unread).each do |mail|
bod = mail.message.body.to_s
end

Is this the best way to do get the message text or I made a workaround?

Tks and congrats for the gem =)

Copied from original issue: nu7hatch/gmail#44

lib fails on connect

From @tjgillies on June 4, 2011 10:0

So im trying to make a test for my gmail method. this is the error:

Failures:

  1) sendmail method should send an email given a keywords, seeds, and a run_number, 
     Failure/Error: sendmail("hello","there",15)
     NoMethodError:
       undefined method `upcase' on nil:NilClass.
# kernel/delta/kernel.rb:79:in `upcase (method_missing)'
     # /Users/tyler/.rvm/rubies/rbx-head/lib/net/imap.rb:2496:in `text_response'
     # /Users/tyler/.rvm/rubies/rbx-head/lib/net/imap.rb:1994:in `response_untagged'
     # /Users/tyler/.rvm/rubies/rbx-head/lib/net/imap.rb:1950:in `response'
     # /Users/tyler/.rvm/rubies/rbx-head/lib/net/imap.rb:1876:in `parse'
     # /Users/tyler/.rvm/rubies/rbx-head/lib/net/imap.rb:1008:in `get_response'
     # /Users/tyler/.rvm/rubies/rbx-head/lib/net/imap.rb:917:in `initialize'
     # ./lib/mailer.rb:3:in `sendmail'
     # ./spec/mailer_spec.rb:4:in `__script__'
     # kernel/common/eval.rb:120:in `instance_eval'
     # kernel/bootstrap/array.rb:97:in `map'
     # kernel/bootstrap/array.rb:97:in `map'

here is my method
variables in all caps are strings switched out to protect the innocent ;)

def sendmail(keywords,seeds,run_number)
  gmail = Gmail.connect(USERNAME,PASSWORD)

  gmail.deliver do
    to EMAIL_ADDRESS
    subject "new machine run #{run_number}"
    body "machine run is done: keywords: #{keywords} seeds: #{seeds} URL/#{run_number}"
  end
end

Copied from original issue: nu7hatch/gmail#26

Modifying Constants during SEARCH

From @bb on November 20, 2010 23:9

Hi,

thanks for this Gem. It was a bit hard to find because you didn't fork from dcparker/ruby-gmail so it didn't appear in the Github Network view.
It's good to see someone is carrying this project on, because the other seems to be orphaned and has a lot of bugs which made me try this one.

And I found one here, too:
In https://github.com/nu7hatch/gmail/blob/master/lib/gmail/mailbox.rb#L35 you're getting the entries from MAILBOX_ALIASES and use them directly which makes the a second, less constrained search fail. The line should read:

    search = MAILBOX_ALIASES[args.shift].dup

You can confirm this with these lines:

puts gmail.mailbox("[Gmail]/Spam").emails.count
puts gmail.mailbox("[Gmail]/Spam").emails(:to => "*a*").count
puts gmail.mailbox("[Gmail]/Spam").emails.count
puts Gmail::Mailbox::MAILBOX_ALIASES.inspect

Assuming not all emails in the Spam folder contain an "a" in the recipient, the second number should be smaller and the third number should be equal to the first one again, which is not the case currently. You can also check the MAILBOX_ALIASES after a search which constrains something.

Thanks for your work!
Cheers,
Benjamin

Copied from original issue: nu7hatch/gmail#9

Envelope (only header)

From @rkumar on October 27, 2010 13:37

I am writing an ncurses client using gmail gem. Some issues:

  1. When i fetch :all or :unread, the unread status in gmail is changed to read. How to avoid this, since i have only displayed subject to user.

After searching I found that fetching ENVELOPE lets me see headers without resetting UNREAD status. Also, this is fast, compared to normal method. But gmail gem does not support ENVELOPE.

imap.fetch(message_id, "ENVELOPE")[0].attr["ENVELOPE"] 

I would like fetch body only when user clicks on mail, and only then should mail be changed to READ on gmail.

Look forward to your comments.

  1. If i retrieve :all, is there any flag to check for UNREAD. Currently i have to retrieve them in 2 loops, so i can show user which are UNSEEN.

Copied from original issue: nu7hatch/gmail#3

Many changes...

From @ducngtuan on February 20, 2011 22:2

Sorry, at first I just want to fix some bugs but then I think the design is somehow not very nice. And it turns out that I have done some drastic changes. You don't have to pull all my commits, I just hope you could take a look. Here are what I've done:

  1. AuthorizationError should be StandardError or you have to change the raise statements (Net::IMAP::NoResponseError has special constructor which includes a Net::IMAP::Response).
  2. Client is now a class. And I made a Connection class to replace the old Client::* things.
  3. No more Labels class. I made a MailboxController, which controls mailboxes (labels are mailboxes).
  4. Mailbox has some new functions.
  5. The system standard mailboxes can be mapped now. It should be able to map even in non-english Gmail. I've just added support for english and german (which i currently use) till now.

It would be difficult to merge all my commits. I have very little experiences in SE so I messed up :">

Copied from original issue: nu7hatch/gmail/pull/20

Couldn't login to given GMail account: [email protected]

From @webdevotion on July 19, 2011 10:0

Every once and a while ( local dev machine ) I run into this problem.
No idea what is causing it.

Couldn't login to given GMail account: [email protected]

My code running in a controller:

    begin
      logger.info("log in")
      gmail = Gmail.connect!('[email protected]','44444444444')
      @emails = gmail.inbox.find(:from => "*@domain.tld", :after => Date.parse("2011-07-10")).reverse
    rescue Exception => exc
      logger.error("could not get to the emails: #{exc.message}")
    ensure

    end

I would be more than happy to provide more debug information.

  • Ruby 1.8.7 p 352
  • Ruby On Rails 2.3.8
  • Using RVM
gem list gmail

*** LOCAL GEMS ***

gmail (0.4.0)
gmail_xoauth (0.3.0)

Copied from original issue: nu7hatch/gmail#30

Added Mutex.new statement to prevent deadlocking error

From @saranyan on June 16, 2011 18:9

Hi, in ruby 1.9, there were errors when I tried to use the gem.
internal:prelude:8:in `lock': deadlock; recursive locking (ThreadError)
I traced it to base.rb statement - @mailbox_mutex.synchronize do
This does not make sense to me as it should be a mutex variable. I just made this into mutex variable and the errors went away. Thought this might be useful to others.

thanks!
great Gem. very useful. thanks :)

Copied from original issue: nu7hatch/gmail/pull/28

possible race condition in emails()

From @rkumar on October 31, 2010 6:3

I have one thread checking for count of unread emails in INBOX, another one is calling emails for all emails. I think the data is getting mixed.

The situation is that i use a thread to check unread counts for all labels (so that application is not held up). In the meantime, user fetches mails for Inbox. It appears that 2 concurrent calls for messages of one label, cause data inconsistency.

Perhaps this is an application issue, but i thought i would just point it out to you.

Copied from original issue: nu7hatch/gmail#6

undefined method `save_attachments_to' for Gmail::Message

From @webdevotion on July 19, 2011 10:39

I'm not able to save attachments:

unless email.attachments.empty?
  folder = "/public/system/files/"
  begin
    email.save_attachments_to( folder )
  rescue Exception => exc
    logger.error( exc.message )
  ensure
end

error message
```undefined method`save_attachments_to' for #<Gmail::Message0x123 mailbox=INBOX uid=124222>


Also tried going through each attachment and save them using
```attachment.save_to_file( location )

but it also results in undefined method save_to_file

Copied from original issue: nu7hatch/gmail#31

'Net::IMAP::BadResponseError' >>> unknown command

From @syntaxTerr0r on September 4, 2011 3:36

This error occurs randomly while using the lib.

The exact problem is well described here : http://stackoverflow.com/questions/6385276/unknown-command-on-gmail-gem

I'm trying to get my emails using the Gmail gem (source) with the next call:

class MyClass
  def initialize account, credentials
    @gmail = Gmail.connect(account, credentials)
  end

  def get_attachments received_at, options
    mails = @gmail.inbox.find(
      :to => options[:to],
      :has=>:attachments,
      :before => options[:end_date],
      :after => received_at
     )
     #more code
   end
end

@gmail is a valid instance of Gmail class, and this call raises sometimes the next error:

Unknown command v2if4084974eef.9

The command (v2if4084974eef.9) changes in every call I make.

What am I doing wrong?

I'm using ruby-1.9.2-p180 and rails 3.1.0

Copied from original issue: nu7hatch/gmail#36

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.