Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot send mail #32

Closed
jennybc opened this issue Nov 1, 2015 · 3 comments
Closed

cannot send mail #32

jennybc opened this issue Nov 1, 2015 · 3 comments

Comments

@jennybc
Copy link
Member

jennybc commented Nov 1, 2015

For my class, I've been using the CRAN version but thought I'd try dev version today. But I cannot seem to send mail. Below I'm using your built-in global project (although I don't when sending course email for real), and have already cached an auth token in working directory here.

library(gmailr)

text_msg <- mime() %>%
  to("jenny@stat.ubc.ca") %>%
  from("jenny@stat.ubc.ca") %>%
  text_body("default credentials, to and from jenny@stat.ubc.ca")

ret <- text_msg %>%
  send_message()
#> Error in gmailr_query(POST, location, user_id, class, ...): cannot change value of locked binding for '.last_response'

## try the example from send_message()
send_message(mime(from="jenny@stat.ubc.ca", to="jenny@stat.ubc.ca",
                  subject="hello", "how are you doing?"))
#> Error in gmailr_query(POST, location, user_id, class, ...): cannot change value of locked binding for '.last_response'

session_info("gmailr")
#> Session info --------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.2.2 (2015-08-14)
#>  system   x86_64, darwin13.4.0        
#>  ui       RStudio (0.99.747)          
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  tz       America/Vancouver           
#>  date     2015-11-01
#> Packages ------------------------------------------------------------------
#>  package   * version    date       source                             
#>  argufy      1.0.0      2015-10-06 Github (gaborcsardi/argufy@f7cfeef)
#>  base64enc   0.1-3      2015-07-28 CRAN (R 3.2.0)                     
#>  curl        0.9.3      2015-08-25 CRAN (R 3.2.0)                     
#>  digest      0.6.8      2014-12-31 CRAN (R 3.2.0)                     
#>  gmailr    * 0.6.0      2015-11-01 Github (jimhester/gmailr@4c07595)  
#>  httr        1.0.0      2015-06-25 CRAN (R 3.2.0)                     
#>  jsonlite    0.9.17     2015-09-06 CRAN (R 3.2.0)                     
#>  magrittr    1.5        2014-11-22 CRAN (R 3.2.0)                     
#>  mime        0.4        2015-09-03 CRAN (R 3.2.0)                     
#>  R6          2.1.1      2015-08-19 CRAN (R 3.2.0)                     
#>  stringi     1.0-1      2015-10-22 CRAN (R 3.2.0)                     
#>  stringr     1.0.0.9000 2015-10-27 Github (hadley/stringr@3813041)
@jennybc
Copy link
Member Author

jennybc commented Nov 2, 2015

OK I re-installed but get much the same result.

suppressPackageStartupMessages(library(gmailr))
suppressPackageStartupMessages(library(dplyr))

text_msg <- mime() %>%
  to("jenny@stat.ubc.ca") %>%
  from("jenny@stat.ubc.ca") %>%
  text_body("default credentials, to and from jenny@stat.ubc.ca")

ret <- text_msg %>%
  send_message()
#> Error in the$last_response <<- content(req, "parsed"): cannot change value of locked binding for 'the'
#> Error in gmailr_query(POST, location, user_id, class, ...): cannot change value of locked binding for '.last_response'

## try the example from send_message()
send_message(mime(from="jenny@stat.ubc.ca", to="jenny@stat.ubc.ca",
                  subject="hello", "how are you doing?"))
#> Error in the$last_response <<- content(req, "parsed"): cannot change value of locked binding for 'the'
#> Error in gmailr_query(POST, location, user_id, class, ...): cannot change value of locked binding for '.last_response'

devtools::session_info("gmailr")
#> Session info --------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.2.2 (2015-08-14)
#>  system   x86_64, darwin13.4.0        
#>  ui       RStudio (0.99.747)          
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  tz       America/Vancouver           
#>  date     2015-11-02
#> Packages ------------------------------------------------------------------
#>  package   * version    date       source                             
#>  argufy      1.0.0      2015-11-02 Github (gaborcsardi/argufy@f7cfeef)
#>  base64enc   0.1-3      2015-07-28 CRAN (R 3.2.0)                     
#>  curl        0.9.3      2015-08-25 CRAN (R 3.2.0)                     
#>  digest      0.6.8      2014-12-31 CRAN (R 3.2.0)                     
#>  gmailr    * 0.6.0      2015-11-02 Github (jimhester/gmailr@dcec99a)  
#>  httr        1.0.0      2015-06-25 CRAN (R 3.2.0)                     
#>  jsonlite    0.9.17     2015-09-06 CRAN (R 3.2.0)                     
#>  magrittr    1.5        2014-11-22 CRAN (R 3.2.0)                     
#>  mime        0.4        2015-09-03 CRAN (R 3.2.0)                     
#>  R6          2.1.1      2015-08-19 CRAN (R 3.2.0)                     
#>  stringi     1.0-1      2015-10-22 CRAN (R 3.2.0)                     
#>  stringr     1.0.0.9000 2015-10-27 Github (hadley/stringr@3813041)

jimhester added a commit that referenced this issue Nov 2, 2015
@jimhester
Copy link
Member

Should be fixed now, I was using the wrong assignment operator.

@jennybc
Copy link
Member Author

jennybc commented Nov 2, 2015

Progress but still no joy. Sorry about all this but I'd really like to use the dev version instead of CRAN!

I think the first error is because the scope defaults to "read_only" even though I'm asking to send a message. But then, even once I've authorized the "compose" scope, it seems we're back to that 400 bad request from a while ago?

suppressPackageStartupMessages(library(gmailr))
suppressPackageStartupMessages(library(dplyr))

send_message(mime(from="jenny@stat.ubc.ca", to="jenny@stat.ubc.ca",
                  subject="hello", "how are you doing?"))
#> Use a local file to cache OAuth access credentials between R sessions?
#> 1: Yes
#> 2: No
#> 
#> Selection: 1
#> Waiting for authentication in browser...
#> Press Esc/Ctrl + C to abort
#> Authentication complete.
#> Error in gmailr_query(POST, location, user_id, class, ...) : 
#>   client error: (403) Forbidden

gmail_auth(scope = "compose")
#> Waiting for authentication in browser...
#> Press Esc/Ctrl + C to abort
#> Authentication complete.

send_message(mime(from="jenny@stat.ubc.ca", to="jenny@stat.ubc.ca",
                  subject="hello", "how are you doing?"))
#> Error in gmailr_query(POST, location, user_id, class, ...): client error: (400) Bad Request

text_msg <- mime() %>%
  to("jenny@stat.ubc.ca") %>%
  from("jenny@stat.ubc.ca") %>%
  text_body("default credentials, to and from jenny@stat.ubc.ca")

ret <- text_msg %>%
  send_message()
#> Error in gmailr_query(POST, location, user_id, class, ...): client error: (400) Bad Request

devtools::session_info("gmailr")
#> Session info --------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.2.2 (2015-08-14)
#>  system   x86_64, darwin13.4.0        
#>  ui       RStudio (0.99.747)          
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  tz       America/Vancouver           
#>  date     2015-11-02
#> Packages ------------------------------------------------------------------
#>  package   * version    date       source                             
#>  argufy      1.0.0      2015-11-02 Github (gaborcsardi/argufy@f7cfeef)
#>  base64enc   0.1-3      2015-07-28 CRAN (R 3.2.0)                     
#>  curl        0.9.3      2015-08-25 CRAN (R 3.2.0)                     
#>  digest      0.6.8      2014-12-31 CRAN (R 3.2.0)                     
#>  gmailr    * 0.6.0      2015-11-02 Github (jimhester/gmailr@c834010)  
#>  httr        1.0.0      2015-06-25 CRAN (R 3.2.0)                     
#>  jsonlite    0.9.17     2015-09-06 CRAN (R 3.2.0)                     
#>  magrittr    1.5        2014-11-22 CRAN (R 3.2.0)                     
#>  mime        0.4        2015-09-03 CRAN (R 3.2.0)                     
#>  R6          2.1.1      2015-08-19 CRAN (R 3.2.0)                     
#>  stringi     1.0-1      2015-10-22 CRAN (R 3.2.0)                     
#>  stringr     1.0.0.9000 2015-10-27 Github (hadley/stringr@3813041)

I sent my most recent batch of email last night with the CRAN version, so I can give this a rest for another week or too and come back 😬.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants