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

E-mail is sent as "inline" attachment instead of regular mail body #55

Closed
salim-b opened this issue May 31, 2019 · 4 comments · Fixed by #84
Closed

E-mail is sent as "inline" attachment instead of regular mail body #55

salim-b opened this issue May 31, 2019 · 4 comments · Fixed by #84

Comments

@salim-b
Copy link
Contributor

salim-b commented May 31, 2019

Whenever I send an e-mail using blastula::smtp_send() the actual message is sent as an "inline attachment" which – at least in Thunderbird 60 with default settings – results in no (visual) text in the mail body unless you explicitly activate Display Attachments Inline.

In the code of smtp_send.R I see that mailsend-go's attach option is used with the -inline flag. I guess it would be better to use the body option instead (at least by default), so that all mail clients can properly display the message.

Or is there a specific reason why the attach option is used?


I'm using the latest dev version of blastula on Ubuntu Linux 16.04 with latest mailsend-go v1.0.4.

@rich-iannone
Copy link
Member

@salim-b Sorry for the delay in getting back to you on this. Could you send a screenshot of a sample email in Thunderbird 60 that shows the issue?

@salim-b
Copy link
Contributor Author

salim-b commented Jul 5, 2019

  1. I just realized I'm using the add-on Thunderbird Conversations (latest version), though it doesn't really make any difference regarding this issue.

    Using this add-on, an e-mail sent by blastula::smtp_send() looks by default like this on my system:

    1

  2. When I deactivate the add-on, an e-mail sent by blastula::smtp_send() looks by default like this on my system:

    4

  3. After enabling Thunderbird's option Display Attachments Inline I just discovered another issue (haven't noticed it before): The encoding of the inline attached mail body is not properly auto-discovered! The mail is displayed in latin-1 instead of the actual UTF-8 encoding:

    2

    The same mail sent using mailsend-go's body option displays fine by default:

    3

@salim-b
Copy link
Contributor Author

salim-b commented Jul 16, 2019

In the code of smtp_send.R I see that mailsend-go's attach option is used with the -inline flag. I guess it would be better to use the body option instead (at least by default), so that all mail clients can properly display the message.

To be more clear: Instead of this code

  run_args <-
    list(
      `-sub` = subject,
      `-smtp` = credentials$host,
      `-port` = credentials$port %>% as.character(),
      `-ssl` = ssl_opt,
      `auth` = no_options(),
      `-user` = credentials$user,
      `-pass` = credentials$password,
      `-fname` = sender_name_opt,
      `-from` = from,
      `-to` = to,
      `-cc` = cc,
      `-bcc` = bcc,
      `attach` = no_options(),
      `-file` = tempfile_,
      `-mime-type` = "text/html",
      `-inline` = no_options()
    )

I would suggest to use this (at least by default):

  run_args <-
    list(
      `-sub` = subject,
      `-smtp` = credentials$host,
      `-port` = credentials$port %>% as.character(),
      `-ssl` = ssl_opt,
      `auth` = no_options(),
      `-user` = credentials$user,
      `-pass` = credentials$password,
      `-fname` = sender_name_opt,
      `-from` = from,
      `-to` = to,
      `-cc` = cc,
      `-bcc` = bcc,
      `body` = no_options(),
      `-file` = tempfile_,
      `-mime-type` = "text/html"
    )

@fmichonneau
Copy link
Contributor

I did a quick test and I can confirm that using the body option to pass the HTML file for the email instead of using attach displays the email correctly instead of showing an empty message with an attachment.

salim-b added a commit to salim-b/republik_mailer that referenced this issue Dec 9, 2019
this is a workaround to avoid messages being sent as inline attachment instead of regular body, cf. rstudio/blastula#55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment