首页 > 解决方案 > 是否可以将此文本电子邮件链接更改为 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...`);
  }

标签: javascript

解决方案


推荐阅读