天行健, 君子以自强不息
Sunny's Blog
Title

HTML mailto link

What is mailto link

Mailto link is a type of HTML link that activates the default mail client on the computer for sending an e-mail. The web browser requires a default e-mail client software installed on his computer in order to activate the e-mail client. If you have Microsoft Outlook, for example as your default mail client, pressing a mailto link will open a new mail window.

How to set mailto link

1.Basic

              Nothing just open the mail window.
              <a href="mailto:">mailto</a>
              
              Add 'to' info
              <a href="mailto:obama@whitehouse.gov">mailto</a>
              
              Add more 'to' info
              <a href="mailto:obama@whitehouse.gov,michelle@whitehouse.gov">mailto</a>
            

2.Adding CC and BCC

              <a href="mailto:obama@whitehouse.gov?cc=michelle@whitehouse.gov&bcc=joe@whitehouse.gov">mailto</a>
              Here "?" is first parameter delimiter, "&" is other parameters delimiter  
            

3.Adding a subject

              <a href="mailto:obama@whitehouse.gov?subject=Congrats%20Obama">mailto</a>
              You can replace spaces with "%20", encodeURIComponent first is better.
            

4.Adding Body Text

              <a href="mailto:obama@whitehouse.gov?subject=Congrats%20Obama&body=Enjoy%20your%20stay%0ARegards%20">mailto</a>
              Here "%0A" is change another line
            
地势坤,君子以厚德载物