【问题标题】:How to send hyperlink with mailR?如何使用mailR发送超链接?
【发布时间】:2016-07-22 02:34:51
【问题描述】:

示例代码:

library(mailR)

path='/Users/me/Downloads/file.xlsx'

send.mail(from = sender,
          to = recipients,
          subject = 'email with hyperlink',
          body = c(path),
          html = FALSE,
          inline = FALSE,
          smtp = list(host.name = a, port = b, 
                      user.name = c,            
                      passwd = d, ssl = TRUE),
          authenticate = TRUE,
          send = TRUE)

是否可以将路径显示为电子邮件正文中的超链接?

【问题讨论】:

  • 试试html = TRUE :)
  • @daroczig:感谢 url 案例!我刚刚编辑了示例:我实际上想生成一个链接到某个文件夹位置的超链接。
  • 不确定您的意思:您想添加指向本地文件的链接?接收者如何能够从远程机器访问它?为什么不将该 Excel 电子表格作为附件添加到电子邮件中,或者通过网络服务器使文件可用,以便您可以链接到它?
  • 谢谢。我可能会把它作为附件发送。

标签: r email hyperlink


【解决方案1】:

使用您的示例:

library(mailR)

path="file:///C:\\Users\\me\\Downloads\\file.xlsx"

send.mail(from = sender,
          to = recipients,
          subject = 'email with hyperlink',
          body = path,
          html = FALSE,
          inline = FALSE,
          smtp = list(host.name = a, port = b, 
                      user.name = c,            
                      passwd = d, ssl = TRUE),
          authenticate = TRUE,
          send = TRUE)

【讨论】:

  • 很抱歉,如果不清楚;如果您使用 'file:///...' 格式化 'path' 并在其余部分使用双反斜杠; '\\' 然后电子邮件的正文将自动超链接。这能回答问题吗?
猜你喜欢
  • 2014-07-11
  • 2020-11-20
  • 1970-01-01
  • 2013-05-31
  • 2017-12-29
  • 1970-01-01
  • 1970-01-01
  • 2021-08-13
相关资源
最近更新 更多