Search code examples
htmlformsgmail

How to add a line break on email body when we send email with to, subject and body?


I have requirement where information is sent to an end user via gmail (Preferred one) and he/she has to click on a button on the email body to respond back. The button response works with predefined to,subject and body but I facing difficulty in putting body in two line. I want end user to put a commend on the send line but it the pre-composed email comes in single line.

Example: Interested to buy the gadget.%0d%0a###Please put your comments below this###

But I am looking for like below.

Interested to buy the gadget.

Please put your comments below this

Code given below

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<span class="heading"><br/>Hello !!!,<br/><br/></span>
Would like to accept my proposal to buy the gadget. Please click on below button to send us a reply with comments.<br/><br/>
        <form style="display: inline;" action="https://mail.google.com/mail/">
        <input type="hidden" name="view" value="cm"/>
        <input type="hidden" name="fs" value="1"/>
        <input type="hidden" name="to" value="[email protected]"/>
        <input type="hidden" name="su" value="I am happy to buy the gadget"/>
        <input type="hidden" name="body" value="Interested to buy the gadget.%0d%0a###Please put your comments below this###"/>
        <input type="submit" value="Interested" />
        </form>
        <form style="display: inline;" action="https://mail.google.com/mail/">
        <input type="hidden" name="view" value="cm"/>
        <input type="hidden" name="fs" value="1"/>
        <input type="hidden" name="to" value="[email protected]"/>
        <input type="hidden" name="su" value="May be some other time"/>
        <input type="hidden" name="body" value="Not Interested to buy the gadget.%0d%0a###Please put your comments below this###"/>
        <input type="submit" value="Not Interested" />
        </form>
        </form>
<br/>
</body>
</html>

Solution

  • I would add the break with javascript like: (see last form)

    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    <span class="heading"><br/>Hello !!!,<br/><br/></span>
    Would like to accept my proposal to buy the gadget. Please click on below button to send us a reply with comments.<br/><br/>
            <form style="display: inline;" action="https://mail.google.com/mail/">
            <input type="hidden" name="view" value="cm"/>
            <input type="hidden" name="fs" value="1"/>
            <input type="hidden" name="to" value="[email protected]"/>
            <input type="hidden" name="su" value="I am happy to buy the gadget"/>
            <input type="hidden" name="body" value="Interested to buy the gadget.%0d%0a ###Please put your comments below this###"/>
            <input type="submit" value="Interested" />
            </form>
    
    
            <form style="display: inline;" action="https://mail.google.com/mail/">
            <input type="hidden" name="view" value="cm"/>
            <input type="hidden" name="fs" value="1"/>
            <input type="hidden" name="to" value="[email protected]"/>
            <input type="hidden" name="su" value="May be some other time"/>
            <input type="hidden" name="body" id="body_text" value="test"/>
            <input type="submit" value="Not Interested" />
            </form>
                    <script>
                        document.getElementById('body_text').value = 'Not Interested to buy the gadget. \r\n ###Please put your comments below this###';
                    </script>
    <br/>
    </body>
    </html>