AMT2 - Extracting Emails from your Gmail Inbox using python

Sdílet
Vložit
  • čas přidán 28. 08. 2024
  • Do not waste your time doing manual things that can be automated. This video walks you through the simple python code to extract required information from your Gmail inbox. A great way pf compiling text for your natural language processing and other machine learning projects.
    You can find the code to this video and other videos here:
    github.com/bns...

Komentáře • 59

  • @saratchaitanya402444
    @saratchaitanya402444 Před rokem +2

    Thanks to your video. I was stuck at the authentication part and I was trying to find the reasons for authentication failure. Through your video I understood where I was wrong .

  • @alvinclydeevangelista310

    Thank you, very helpful. Now I can use some natural language processing with my emails!

  • @federicojosegonzaleztoimil2895

    Thanks, very clear and usefull. With this I automate a manual task in my business (without the expensive Zapier jeje)

  • @lordcoco_
    @lordcoco_ Před 15 hodinami

    super clear and helpful. thanks!

  • @aetzag5448
    @aetzag5448 Před rokem +1

    Very useful. Thank you for sharing your work and knowledge.

  • @davem45
    @davem45 Před rokem +2

    So glad I found your channel. Awesome tutorial. I would like to know if there is a way to get emails based on sender, month, and attachments? Each month when I do my reconciliation I have to search for the receipts and would like to automate that process so I can have python find and extract the pdfs. Is that even possible? (New to python) thank you

  • @ElProsaso001
    @ElProsaso001 Před rokem

    Amazing video, very simple and helpfull, thanks a lot!

  • @BuiTuanKiet-on6cc
    @BuiTuanKiet-on6cc Před 4 měsíci +1

    i cant fix this error:
    raise self.error(dat[-1])
    imaplib.IMAP4.error: b'[AUTHENTICATIONFAILED] Invalid credentials (Failure)'

  • @spicer41282
    @spicer41282 Před rokem +1

    👍You're a Natural Teacher!
    Love your explanations.
    An Even more detailed deeper explanations ?
    for each variable arguments would be a Welcomed! fresh learning experience...
    Specially for Noobies like me.
    Can you expand on this code to include Images?
    Thanks in advance for doing so.
    Sub'd and Liked!
    👍

  • @leonardroberts5715
    @leonardroberts5715 Před 2 lety +3

    code is missng from github

  • @SSSGISitapur
    @SSSGISitapur Před 2 měsíci

    hello sir. i created app password but my google crome not showing options as 4.10 time as in your video. i have two step verification also.

  • @alexmckinley79
    @alexmckinley79 Před 5 měsíci

    Thanks so much for your help!

  • @ayushagarwal8720
    @ayushagarwal8720 Před rokem

    Thank you so much Sir, this video was very helpful. Thank you

    • @DigitalSreeni
      @DigitalSreeni  Před rokem +1

      You are most welcome

    • @PaulsVeinbergs
      @PaulsVeinbergs Před rokem

      @@DigitalSreeni but this is not working bec of the google remove app password section and we got authentication credentials error

  • @atangbingana283
    @atangbingana283 Před 11 měsíci

    For example @DigitalSreeni I receive like 100 emails a week with updated inventory can I use this script to scrape that data from my gmail to pandas then to excel or do you have a video that can help me achieve that ?

  • @user-en1ob4rd3l
    @user-en1ob4rd3l Před 6 měsíci

    how I can get the emails information and send it to another application ? not for my account only ?

  • @prasandkumar1464
    @prasandkumar1464 Před 2 lety

    Thank you Sreeni, it was awesome. I wanted to search emails received in the last 1 hour. But i found out in the imaplib search function we could use only date filters. Please correct me, if i'm wrong. Is there a way to use datetime filter.
    Thanks in Advance.

  • @phmzk
    @phmzk Před 2 lety

    This was very handy, and nicely explained, so thanks! Would you be able to elaborate on a few parts though? One being the key = 'FROM'...is there a way to build out the search here a little more? It also only seems to apply to a sender...what if I want to search for a phrase in my emails? The second thing is when you're executing the loop and use the get_payload(). This is outputting a large body of text for my particular case, whereas what I actually want is to be able to inspect that body and search for a few items: date mentioned, and value - these two are consistently in all my emails that I'm pulling, and always following the same pattern, so I've been trying to adapt your script by setting a variable as part.get_payload() instead of printing, assuming this is then storing that body string on which I can then run the search...but it doesn't seem to work. Would appreciate a follow-on tutorial or advice if you are able to :)

  • @salonitongia
    @salonitongia Před 9 měsíci

    This video is really helpful. however I am in process of developing a coding mechanism to fetch otp from gmail and enter it on another app. can you make a video for the same pls ?

  • @Sapandream007
    @Sapandream007 Před rokem +1

    it is saying app password is not avaiable for your account
    india

  • @palsam7767
    @palsam7767 Před 2 lety

    If I try to fetch only the SUBJECT using,
    typ, data = my_mail.fetch(nu, '(SUBJECT)')
    I am getting following error:
    error: FETCH command error: BAD [b'Could not parse command']
    I need to fetch only the subject and the time it received, not the RFC822. could you pls help

  • @flowcharttocodeconverter936
    @flowcharttocodeconverter936 Před 10 měsíci

    Very good !

  • @TruongPham-tz9vi
    @TruongPham-tz9vi Před rokem

    Thank for your helpfull tutorial. I did like your tut step by step, but get error ((with open("credentials.yml") as f:SyntaxError: unexpected EOF while parsing)) when run in spyder console. But when i open windows cmd, it work fine.

  • @kingsnow6718
    @kingsnow6718 Před rokem

    Is there any need or method to logout Gmail..after Complete Process..I mean for Security purpose

  • @oleksandr8607
    @oleksandr8607 Před rokem

    Thank you very much!

  • @ZiadAlshoura
    @ZiadAlshoura Před 2 měsíci

    what is the "_" in line 49 ?

  • @jonasrayet9369
    @jonasrayet9369 Před rokem

    Hey there, I know this is quite old now but could you send me towards a vid that would explain how to then open a specific reoccurring link contained in the email ? (I'm creating a bot that would apply automatically for flat viewings)
    Coming from a beginner, thank you so much for your videos ;)

  • @dinohasanbasic5714
    @dinohasanbasic5714 Před 2 lety

    Hi, this is a great tool, now my question is, can i and how, add multiple gmail folders, lets say i have 30 gmails i want extracted, how can i in the do not share credentials file add more then one gmail accounts to check and make the tool go thru all accounts and export

  • @NehaaShri
    @NehaaShri Před 6 měsíci

    how do I. Keep running this constantly

  • @monty510
    @monty510 Před 7 měsíci

    Thank you so much

  • @maffigabri
    @maffigabri Před 2 lety +1

    Your GIthub misses AMT2 file and folder

    • @DigitalSreeni
      @DigitalSreeni  Před 2 lety

      Thanks for alerting me about the missing files. I've uploaded them. Here is the direct link: github.com/bnsreenu/python_for_microscopists/tree/master/AMT_02_extract_gmails_from_a_user

  • @donaldsouillet2307
    @donaldsouillet2307 Před 2 lety

    I think there is a newer method to do this?

  • @freeaudiobook7638
    @freeaudiobook7638 Před rokem +1

    No longer available

  • @bharathraj4545
    @bharathraj4545 Před 2 lety

    how to create a yml file. Please help me with this.

  • @AI_DOL_
    @AI_DOL_ Před rokem

    But pls how do I convert it to CSV???

  • @MikeD-qx1kr
    @MikeD-qx1kr Před rokem

    Great video, but is the code gone from github?

    • @DigitalSreeni
      @DigitalSreeni  Před rokem +1

      No, it is there. github.com/bnsreenu/python_for_microscopists/tree/master/AMT_02_extract_gmails_from_a_user

    • @MikeD-qx1kr
      @MikeD-qx1kr Před rokem +1

      @@DigitalSreeni Found it thanx. Would be interesting a sequel on how to put data from email into pandas dataframe or even a SQL database.

  • @akashr8514
    @akashr8514 Před 2 lety

    we need one help from you sir for our project please can u help

  • @kwitt2190
    @kwitt2190 Před 2 lety +1

    😜 Promo>SM!!!

  • @shantanutiwari8726
    @shantanutiwari8726 Před 3 měsíci

    hi

  • @TheCubicalGamer
    @TheCubicalGamer Před 2 lety

    If we want to look through all emails what parameters should my_mail.search() have?

  • @dammitanothername
    @dammitanothername Před rokem

    #regarding
    typ, data = my_mail.fetch(num, '(RFC822)')
    File "C:\ProgramData\Anaconda3\lib\imaplib.py", line 548, in fetch
    typ, dat = self._simple_command(name, message_set, message_parts)
    File "C:\ProgramData\Anaconda3\lib\imaplib.py", line 1230, in _simple_command
    return self._command_complete(name, self._command(name, *args))
    File "C:\ProgramData\Anaconda3\lib\imaplib.py", line 1055, in _command_complete
    raise self.error('%s command error: %s %s' % (name, typ, data))
    error: FETCH command error: BAD [b'Could not parse command']
    regardless of whose code I use, there are other code snippets out there, miap4 pukes at this stage.
    did I had a port? yes, no difference.
    did I switch to double quotes? yes, no difference.
    did I use "imap.gmail.com" ? yes, no difference.
    I have tried all the suggestions and none helped.

    • @apoorvpandit4635
      @apoorvpandit4635 Před rokem

      Were you able to solve this error? Because I'm stuck at the same point.