Skip to content

Subject becomes garbled when it contains accented character and more than 55 characters #193

@mikeblazanin

Description

@mikeblazanin

Weird bug here. If I send an email with a subject line containing an accented character, it works fine as long as the subject is 55 characters long or less:

message <- gm_mime() |>
  gm_to("testreceive@gmail.com") |>
  gm_from("testsend@gmail.com>") |>
  gm_subject("áaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") |>
  gm_html_body("hello world")

gm_send_message(message)

When viewed in gmail, the subject line reads as intended.

But if the subject line is 56 characters long (or longer), it comes out garbled:

message <- gm_mime() |>
  gm_to("mikeblazanin@gmail.com") |>
  gm_from("Zotero Recommender <ZoteroRecommender@gmail.com>") |>
  gm_subject("áaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") |>
  gm_html_body("hello world")

gm_send_message(message)

When viewed in gmail, the subject line reads as: "=?utf-8?B?w6FhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh"

Other notes: subject lines without accents more than 55 characters do just fine. The error still appears if you create a draft then send the draft.

Session info: I'm using a cached login to set up my authorization before running the example code above

options(gargle_oauth_cache = ".gargle_cache",
        gargle_oauth_email = TRUE)

gm_auth_configure(path = "./data-raw/client_secret_abcde.json")
gm_auth(email = "testsend@gmail.com",
        token = "./data-raw/gmailr-token.rds")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions