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
Body is blank after attaching file #60
Comments
I have this issue too... I also find that I can't send both text and html body parts. |
I got the same problem... |
I have the same issue and haven't figured out a solution yet. |
I had some luck using the format below. For some reason taking out either the html_body or the attach_part terms would hide the text. html_msg <- mime() %>% |
It would seem like there are duplicated fields generated from the mime construction, so it's last-in first-out as far as the request is concerned... thus dropping any body info related to a message. @jonspring 's solution works nicely. |
If the message was html, it would still appear as text though. Is there any way to send html along with an attachment? |
I'm trying to send 2 attachments. Getting them both in the one email is more important than getting the body to show nicely (or at all). Here is the only combination of calls that I could get to work:
At some point I managed to send an HTML body and one attachment, but the HTML didn't render. So this seems to be a very fragile interface. |
Hello all, Newbie to R so please be patient with my comment. I am trying to simply attach a csv file in a message, so that the receiver can download as it is and use. Is this possible with gmailR? Thank you |
There seems to be a nice workaroud to get the HTML outputs too. All you need to do is attach_file() the .html along with the attachment. Following format works for me. email <- send_message(email) Note:- Through trial and errors it appears that any arbitrary argument needs to be passed to the 'html_body()' without which this wouldn't work. Hence the empty quotes there. |
This is now fixed without workarounds pkgload::load_all("~/p/gmailr")
#> Loading gmailr
write.csv(iris, "iris.csv")
gm_mime() %>%
gm_from("email@foo.com") %>%
gm_to("email@bar.com") %>%
gm_subject("I bought you") %>%
gm_text_body('Some flowers!') %>%
gm_attach_file("iris.csv") %>%
gm_create_draft()
#> Draft Id: r-2808894807153655050
#> Thread Id: 16cab9f58efda151 Created on 2019-08-19 by the reprex package (v0.3.0) |
I haven't actually come across an example which does this but I was hoping that this would work:
write.csv(file = "iris.csv", iris)
mime() %>%
to('someaddress@somewhere.com') %>%
from("someaddress@somewhere.com") %>%
subject("Test subject") %>%
text_body("Test body") %>%
attach_file("iris.csv") %>%
send_message()
Although the email is sent with the attachment, the body is not included in the email. It seems to be dropped entirely from the message when it's sent although the object that goes into send_message() still includes the body part. It doesn't work with html_body() either, attaching multiple files works fine.
This email does include the body:
mime() %>%
to('someaddress@somewhere.com') %>%
from("someaddress@somewhere.com") %>%
subject("Test subject") %>%
text_body("Test body") %>%
#attach_file("iris.csv") %>%
send_message()
The text was updated successfully, but these errors were encountered: