How to use Mailto link in HTML

 What is Mailto Link ???

Mailto link is  basically a type of HTML link that opens a new mail window by activating the default mail client installed in your PC .

 

  • Now let us suppose you want to send mail to a single person using mailto link then you have to write code as :

<title = "Send Mail" onclick= "javascript:window.location='mailto:person1@domain.com? ;">
  • If you want to send mail to multiple persons using mailto link  for that you need to write our code as:
    <title = "Send Mail" onclick="javascript:window.location='mailto:person1@domain.com,person2@domain.com? ;">
  • If you want to add the person in cc of mail using mailto link ,  write code as :
<title = "Send Mail" onclick= "javascript:window.location='mailto:person1@domain.com?cc=person2@doman.com ;">
  • If you want to add subject to your mail using mailto link then write code as :
<title = "Send Mail" onclick= "javascript:window.location='mailto:person1@domain.com?&subject=Test Mail ;">
  • If you want to add body to your mail using mailto link then write code as :
<title = "Send Mail" onclick= "javascript:window.location='mailto:username@domain.com?&subject=Test Mail&body= Hi ;">
  • If you want to send mail with  line breaks  in mail body using mailto link then add ” %0D%0A ” :
<title = "Send Mail" onclick= "javascript:window.location='mailto:username@domain.com?cc=username@domain.com&subject=Test Mail&body= Hi %0D%0A How are you 
%0D%0A  Thanks and Regards ;">

I hope this will  work for you Happy Coding!!!

 

Leave a Comment

Your email address will not be published.