Git Product home page Git Product logo

Comments (13)

jimhester avatar jimhester commented on June 27, 2024

Try the following which works for me

test_email <- mime(
  To = "[email protected]",
  From = "[email protected]",
  Subject = "this is just a gmailr test")
test_email <- html_body(test_email, "Can <b>you</b> hear me now?")
create_draft(test_email)

from gmailr.

lwasser avatar lwasser commented on June 27, 2024

Thank you @jimhester for the feedback.
create_draft returned the following error:

> create_draft(test_email)
Error in UseMethod("from") : 
  no applicable method for 'from' applied to an object of class "gmail_draft"

My code:

# From Jim Hester
test_email <- mime(
  To = "[email protected]",
  From = "[email protected]",
  Subject = "this is just a gmailr test")
test_email <- html_body(test_email, "Can <b>you</b> hear me now?")

create_draft(test_email)
ret_val <- send_message(test_email)

What did I miss?

from gmailr.

jimhester avatar jimhester commented on June 27, 2024

Try installing the latest version from GitHub.

# install.packages("devtools")
install_github("jimhester/gmailr")

from gmailr.

lwasser avatar lwasser commented on June 27, 2024

OK -- progress! I was able to create a draft once successfully. However, i have not been able to send_message successfully and now after one draft i am getting the error:

Error in loadNamespace(name) : there is no package called ‘crayon’

both when i send_message and create_draft

I triied to install the package crayon but when i do i get another odd output from both send and create draft as follows:

 create_draft(test_email)
Id: r-5335522915222148839
To: 
From: 
Date: 
Subject: 

> send_message(test_email)
Id: 153d3bae42b75989
To: 
From: 
Date: 
Subject: 

from gmailr.

lwasser avatar lwasser commented on June 27, 2024

Hi @jimhester

One other note. When I install from github and try to authenticate, it says it can't find OAuth2 in the browser.

So this line

gmail_auth("data-institute-email.json", scope = 'compose')

Fails. When I install from cran I'm able to authenticate with no problem.
Leah

from gmailr.

jimhester avatar jimhester commented on June 27, 2024

Try installing from GitHub again, I have fixed a few things which should make this work better for you.

You need to use the secret_file parameter to read the secret from the json. Alternatively the github version packages a secret file so you can use that without needing to supply a file.

gmail_auth(secret_file = "data-institute-email.json", scope = 'compose')

I am currently getting a Bounce error when trying to send the email, but the message still seems to go through... Creating a draft with create_draft() then sending that does work however, I am not sure what is going wrong with directly sending...

from gmailr.

jimhester avatar jimhester commented on June 27, 2024

Ok d5db6a7 now sends without Bouncing, so try updating again and let me know if it doesn't work.

from gmailr.

lwasser avatar lwasser commented on June 27, 2024

Thank you. Please tell me if am doing this wrong. I got an error on the install. So I uninstalled gmailr and made sure it was gone in my library dir on my mac. I then installed from github and got the following message / error (at the very bottom):

Downloading` GitHub repo jimhester/gmailr@master
from URL https://api.github.com/repos/jimhester/gmailr/zipball/master
Installing gmailr
Downloading GitHub repo gaborcsardi/argufy@173245a7e
from URL https://api.github.com/repos/gaborcsardi/argufy/zipball/173245a7e
Installing argufy
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file  \
  --no-environ --no-save --no-restore CMD INSTALL  \
  '/private/var/folders/x9/0p6djscn2890hpkvmlz4nx0nn42rsp/T/Rtmpatr7rD/devtools6021099596c/gaborcsardi-argufy-173245a'  \
  --library='/Library/Frameworks/R.framework/Versions/3.2/Resources/library'  \
  --install-tests 

* installing *source* package ‘argufy’ ...
** R
** inst
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (argufy)
Skipping 1 unavailable package: argufy
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file  \
  --no-environ --no-save --no-restore CMD INSTALL  \
  '/private/var/folders/x9/0p6djscn2890hpkvmlz4nx0nn42rsp/T/Rtmpatr7rD/devtools6028b6cef9/jimhester-gmailr-d5db6a7'  \
  --library='/Library/Frameworks/R.framework/Versions/3.2/Resources/library'  \
  --install-tests 

* installing *source* package ‘gmailr’ ...
** R
** tests
** preparing package for lazy loading
** help
Error : /private/var/folders/x9/0p6djscn2890hpkvmlz4nx0nn42rsp/T/Rtmpatr7rD/devtools6028b6cef9/jimhester-gmailr-d5db6a7/man/id.gmail_messages.Rd: Sections \title, and \name must exist and be unique in Rd files
ERROR: installing Rd objects failed for package ‘gmailr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/gmailr’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/gmailr’
Error: Command failed (1)

from gmailr.

jimhester avatar jimhester commented on June 27, 2024

Sorry that was an inadvertent error, sorry for the confusion. It should now be fixed.

from gmailr.

lwasser avatar lwasser commented on June 27, 2024

Ok... it installed perfectly but i'm still getting the following error (it authenticates and then throws an error when i try to create draft or send_email.

Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.
Error: .onLoad failed in loadNamespace() for 'crayon', details:
  call: get0(oNam, envir = ns)
  error: lazy-load database '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/memoise/R/memoise.rdb' is corrupt
In addition: Warning message:
In get0(oNam, envir = ns) : internal error -3 in R_decompress1
> send_message(test_email)
Error: .onLoad failed in loadNamespace() for 'crayon', details:
  call: get0(oNam, envir = ns)
  error: lazy-load database '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/memoise/R/memoise.rdb' is corrupt
In addition: Warning messages:
1: In get0(oNam, envir = ns) : restarting interrupted promise evaluation
2: In get0(oNam, envir = ns) : internal error -3 in R_decompress1

the path there is where my packages are stored so is this error on my end?
Thank you!

from gmailr.

jimhester avatar jimhester commented on June 27, 2024

Something strange is going on. Does this happen if you start an entirely new session? You may want to try reinstalling the crayon package from CRAN as well.

from gmailr.

lwasser avatar lwasser commented on June 27, 2024

ok! Progress. Iyou are right - something was weird with my session. I restarted.
Now i'm not able to use gmail_auth after i install from github. i get the following information in the browser if this helps:

scope=https://www.googleapis.com/auth/gmail.compose
response_type=code
redirect_uri=http://localhost:1410
state=H8JTSXEbMZ
client_id=data-institute-email.json

However, if i install from cran. run gmail_auth AND then install from github, i can send an html email successfully! it does ask me to authenticate a few other items (create draft, etc) when i use create_draft but then it works.

Is there something there that is different in gmail_auth in the git version compared to the cran version?

Thank you so much for working through this with me!

from gmailr.

abhishek1608 avatar abhishek1608 commented on June 27, 2024

@jimhester is there any way we can send whole html file by placing the directory?

from gmailr.

Related Issues (20)

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.