Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
3.1k views
in Web Development by 22 23 29

Is it possible to add custom subject and body in HTML Mailto? I need when click on link redirect to email adress with a default custom subject and body

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

 


1 Answer

1 like 0 dislike
by 161 202 396
selected by
 
Best answer

Add Parameters to MailTo Link in HTML

In the MailTo link in HTML, you can add the below parameters:

  • subject - for the subject line,
  • cc - for sending a carbon copy,
  • bcc - for sending a blind carbon copy,
  • body - for the message's body text.

MailTo link in HTML Example

In this example, you can use To, CC, BCC, Subject, and Body in MailTo link in HTML

<a href="mailto:email@example.com?cc=secondemail@example.com, anotheremail@example.com, &bcc=lastemail@example.com&subject=Mail from our debug.to&body=Welcome to debug.to">Send Email</a>

Output

use To, CC, BCC, Subject, and Body in MailTo link in HTML


Add a subject in the MailTo link in HTML

To add a subject to MailTo link, you can use the below code:

<a href="mailto:email@example.com?subject=Mail from our debug.to">Send Email</a>

Add a body in the MailTo link in HTML

To add a body to MailTo link, you can use the below code:

<a href="mailto:email@example.com?body=Welcome to debug.to">Send Email</a>

Add a CC mail in the MailTo link in HTML

To add a CC to MailTo link, you can use the below code:

<a href="mailto:email@example.com?cc=secondemail@example.com, anotheremail@example.com">Send Email</a>

Add a BCC mail in the MailTo link in HTML

To add a BCC to MailTo link, you can use the below code:

<a href="mailto:email@example.com?bcc=lastemail@example.com">Send Email</a>
by 22 23 29
0 0
That's very clear, thank you
If you don’t ask, the answer is always NO!
...