【问题标题】:How to send an email with subject in HTML form如何以 HTML 形式发送带有主题的电子邮件
【发布时间】:2021-05-11 10:41:21
【问题描述】:

我知道如何使用 action mailto: in form 元素以 html 形式发送电子邮件。 但这会发送没有主题的电子邮件,如何发送带有主题的电子邮件?

【问题讨论】:

标签: javascript html css forms web


【解决方案1】:

<a href="mailto:test@example.com?subject=Testing out mailto!">First Example</a>

更多看here

【讨论】:

    【解决方案2】:

    您的问题不清楚您是否要在用户单击链接时自动添加,或者您发送电子邮件的代码不是带有主题的电子邮件。您需要通过代码示例进行更多解释。

    我假设您要求链接这种情况下您可以使用下面的代码

    <a href="mailto:someone@yoursite.com?subject=Mail from Our Site">Email Us</a> 
    

    一旦使用将单击链接,它将在默认电子邮件客户端中打开链接,例如。带有电子邮件和主题行的前景。

    您可以通过以下方式添加抄送、密送甚至正文文本

    添加抄送和密送

    打开默认邮件程序,使用已填写的收件人、主题、抄送和密件抄送字段创建新邮件。本质上,我们将参数 cc 和 bcc 添加到 href 值。

    另请注意,您将多个值添加到 CC 和 BCC 中,用逗号分隔它们。

    <a href="mailto:someone@yoursite.com?cc=someoneelse@theirsite.com, another@thatsite.com, me@mysite.com&bcc=lastperson@theirsite.com&subject=Big%20News">Email Us</a>
    

    添加正文

    只需将 body 参数添加到我们正在使用的不断增长的参数列表中即可。

    <h2>Basic</h2>
    <p><a href="mailto:someone@yoursite.com">Email Us</a></p>
    <h2>Adding a subject</h2>
    <p><a href="mailto:someone@yoursite.com?subject=Mail from Our Site">Email Us</a></p>
    <h2>Adding CC and BCC</h2>
    <p><a href="mailto:someone@yoursite.com?cc=someoneelse@theirsite.com, another@thatsite.com, me@mysite.com&bcc=lastperson@theirsite.com&subject=Big%20News">Email Us</a></p>
    <h2>Adding body text</h2>
    <p><a href="mailto:someone@yoursite.com?cc=someoneelse@theirsite.com, another@thatsite.com, me@mysite.com&bcc=lastperson@theirsite.com&subject=Big%20News&body=Body-goes-here">Email Us</a></p>

    更多详情here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多