Spaces converting to '+' from HTML form

2019-06-28 08:26发布

So I've been playing around with HTML forms and I am kind of new you all of this so any help would go a long way! But anyway... This is my form coding for emailing.

enter image description here enter image description here

So when I submit that form with the correct areas filled, it then opens in Outlook (2010 If that matters) were it then converts the spaces in the body of the email into '+' (Plus symbols)... Can anyone give me ideas? This HTML will be used on an offline site within our network and will not go live. All computers are on the domain and will have access to this HTML link on there desktop.

2条回答
We Are One
2楼-- · 2019-06-28 08:52

You can use %20 for spaces in mailto links. I think you need to convert the + to spaces before you open the mailto link.

查看更多
淡お忘
3楼-- · 2019-06-28 08:56

You should set the enctype attribute of the <form> tag to text.

<form enctype="text/plain" ...

More details in this KB

In both cases, the FORM data is e-mailed in as an Attachment, in an encoded format. For instance, in the preceding case, this is how the data looks:

Subject=Test+Subject&Body=%09kfdskfdksfkds%0D%0A%09

This is because the default ENCTYPE attribute for the FORM element is "application/x-www-form-urlencoded". To e-mail data in > plain-text format instead, explicitly specify an ENCTYPE attribute of "text/plain". For instance:

<FORM Action="mailto:xyz" METHOD="POST" ENCTYPE="text/plain">
    mailto: protocol test:
    <Br>Subject: 
    <INPUT name="Subject" value="Test Subject">
    <Br>Body:&#xa0;
    <TEXTAREA name="Body">
    kfdskfdksfkds
    </TEXTAREA>
    <BR>
    <INPUT type="submit" value="Submit"> 
</FORM>

produces the following Body:

Subject=Test Subject
Body=   kfdskfdksfkds
查看更多
登录 后发表回答