htmlmailto

发布时间:2026-02-04 01:02:33 浏览次数:0

HTML Mailto

HTML Mailto

The mailto link is used to create a link that opens the user's email program with a pre-filled email address

subject

and body.

Syntax

The mailto link is created using the anchor <a> element and the href attribute.

<a href="mailto:email@example.com">Send email</a>

The email address should be prefixed with mailto:. For example

mailto:email@example.com.

Additional Parameters

Additional parameters can be added to the mailto link to pre-fill the subject and body of the email. The subject parameter is used to specify the subject of the email

and the body parameter is used to specify the body text.

<a href="mailto:email@example.com?subject=Hello%20World&body=This%20is%20the%20body%20of%20the%20email.">Send email with subject and body</a>

In the above example

the subject is set to "Hello World" and the body is set to "This is the body of the email." The space characters in the parameters should be URL-encoded using "%20".

URL Encoding

URL encoding is used to convert special characters and spaces into a format that can be transmitted over the internet. In mailto links

spaces should be replaced with "%20"

and other special characters should be replaced with their corresponding percent-encoded values.

For example:

  • Space: %20
  • At sign (@): %40
  • Question mark (?): %3F

Conclusion

The mailto link is a convenient way to create email links that open the user's email program with a pre-filled email address

subject

and body. It is widely used in HTML forms and websites to allow users to easily contact the website owners or administrators.

需要做网站?需要网络推广?欢迎咨询客户经理 13272073477