Form the correct MIME structure when there's an alternative body and attachment(s)#209
Merged
Form the correct MIME structure when there's an alternative body and attachment(s)#209
Conversation
Member
Author
|
Good manual tests (but, yes, actual tests have been added as well): # Pick one, depending on your situation
#library(gmailr)
devtools::load_all()
# Do you need to authenticate?
# Not necessary when I do `load_all()` as it uses existing token
# gm_auth()
# Test 1: Text + HTML + PDF attachment (send as draft)
# This was one of the original reported scenarios
message1 <- gm_mime() |>
gm_to("jenny+gmailr-tests@posit.co") |>
gm_subject("Test 1: Text+HTML+PDF - Issue #202") |>
gm_text_body("This is the plain text body.") |>
gm_html_body(
"<p>This is the <strong>HTML</strong> body.</p>"
) |>
gm_attach_file(R.home('doc/html/Rlogo.pdf'))
# Create draft (don't send yet - look at the draft first)
draft1 <- gm_create_draft(message1)
# Now send it and check what you received
gm_send_draft(draft1)
# Test 2: Text + HTML + TXT attachment (send directly)
# This was the other main scenario from the issue
message2 <- gm_mime() |>
gm_to("jenny+gmailr-tests@posit.co") |>
gm_subject("Test 2: Text+HTML+TXT - Issue #202") |>
gm_text_body("Plain text body for text attachment test.") |>
gm_html_body("<p><em>HTML body</em> for text attachment test.</p>") |>
gm_attach_file(system.file("DESCRIPTION"), type = "text/plain")
# Send directly
gm_send_message(message2)
# Test 3: Multiple attachments (send as draft)
# Verify the fix works with multiple attachments
message3 <- gm_mime() |>
gm_to("jenny+gmailr-tests@posit.co") |>
gm_subject("Test 3: Text+HTML+Multiple attachments - Issue #202") |>
gm_text_body("Testing with multiple attachments (plain text).") |>
gm_html_body(
"<p>Testing with <strong>multiple attachments</strong> (HTML).</p>"
) |>
gm_attach_file(R.home('doc/html/Rlogo.pdf')) |>
gm_attach_file(R.home('doc/html/logo.jpg'))
draft3 <- gm_create_draft(message3)
gm_send_draft(draft3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #202