Search code examples
htmlmailto

Add newlines to body of mailto: link


My input is from a textbox from HTML form. Using mailto: link, it will send to someone's email. The format on the body of the message is like this:

First=testing&Last=testing&txtChar=123456&emailcheck=testing%40gmail.com

But I want my output like this:

First=testing
Last=testing
txtChar=123456
emailcheck=testing%40gmail.com

Solution

  • To start a new line use, %0A and spaces are %20

    First=testing%0ALast=testing%0A&txtChar=123456%0Aemailcheck=testing%40gmail.com
    

    To convert it to normal text you have to add enctype="text/plain"to your form;

    <form method="post" action="mailto:reyjavebobbyr@gmail.com?Subject=Interactive Test" name="validation" onSubmit="return checkbae()" enctype="text/plain>