Javascript adding linebreak in mailto body

后端 未结 3 661
礼貌的吻别
礼貌的吻别 2020-12-03 21:02

I\'m setting the body of an email using values from a form

  firstname = bob
  lastname = dole

   ebody = \'First Name: \' + firstname + \'\\r\\n\' + \'Last         


        
3条回答
  •  粉色の甜心
    2020-12-03 21:13

    I would expect outlook to try and output this as html/rich text so in that case you would need something like the following (including a urlencoded br tag):

     firstname = bob
      lastname = dole
    
       ebody = 'First Name: ' + firstname + '%3C%2Fbr%3E' + 'Last Name: ' + lastname
    
      window.location.href = 'mailto:myemail@mycompany.com?subject=test
      email&body=' + ebody;
    

提交回复
热议问题