javascript - 是否可以将此文本电子邮件链接更改为 html,或者至少显示替代文本?
问题描述
下面的代码块,单击按钮后,将打开一封电子邮件,其中包含一些文本和我在电子邮件中动态生成的链接body
。这一切都按我的意愿进行,除了它link
很长而且对于接收电子邮件的人来说看起来像是胡言乱语。
是否可以让我mailto:
拥有像 HTML 链接那样的替代文本?甚至是一个按钮而不是完整打印出来的链接?
sendSurvey(employee, employeeId, employmentLevel, audit, client) {
let stringEmployee = employee.replace(/ /g, "%20");
stringEmployee = encodeURI(stringEmployee);
let stringEmploymentLevel = employmentLevel.replace(/ /g, "%20");
stringEmploymentLevel = encodeURI(stringEmploymentLevel);
let stringClient = this.state.selectedClient;
stringClient = stringClient.replace(/ /g, "%20");
stringClient = encodeURI(stringClient);
const link = `http://localhost:3000/hca-survey/${employeeId}/${stringEmployee}/${stringEmploymentLevel}/${this.state.selectedAudit}/${stringClient}`;
const subject = `Human Capital Analysis - ${employee}`;
const body = `Hello, ${employee}. ${client} has selected you to participate in our Human Capital Analysis survey. Please click the link below in order to complete the survey at your convenience.`;
window.open(`mailto:?subject=${subject}&body=${body}
%0D%0A%0D%0A${link}
%0D%0A%0D%0AThank%20You%20for%20your%20responses...`);
}
解决方案
推荐阅读
- postgresql - DBeaver 导入 csv 空字符串作为 NULL 不起作用
- javascript - 从 Firebase 数据库中删除值
- ruby-on-rails - 如何在没有设计的情况下使用 ActiveAdmin 实现自己的身份验证?ActionView::Template::Error: 未定义的方法
- javascript - nan 预测值时 tensorflowjs
- shell - crontab linux中的注释行
- html - 使用 CSS 在悬停时显示元素
- android - 如何为 mpandroidchart 库自定义图表标签
- java - 断言无法解决
- reporting-services - SSRS 中的复合数据过滤器
- php - 无法检查 PHP 到数据库