chau
chau

Reputation: 21

HTML mailto, how to include the sender's email address in the email body?

Please help me in this case. I use mailto function in HTML. But now I need to include the sender's email address in the email's body when the sender clicks on mailto button. It's hard for me.

Anyone please advice me solution or code to do so. Very appreciated.

Thanks,

Upvotes: 2

Views: 2891

Answers (2)

Jan
Jan

Reputation: 1049

When using "mailto:" links in HTML, you can pre-define the following properties:

  • TO recipient
  • CC recipient
  • BCC recipient
  • email body

According to RFC 2368, only the subject and the body parameters are considered save, so email clients will not look for other parameters except those in the list above. This means, theoretically, you could set more header parameters like the sender's address by something like mailto:[email protected]?subject=test&[email protected], but probably no email client will process this parameter.

Upvotes: 0

Kai
Kai

Reputation: 353

To send an email to a specific email address via link, you can use it like this:

<a href="mailto:[email protected]">Send Email</a>

To also send a body and subject parameter to define the content that will be sent, use this;

<a href="mailto:[email protected]?subject=Your+Subject&body=Your+Content">Send Email</a>

Here is a good tutorial for beginners.

Upvotes: 0

Related Questions