I am trying to use the mailto
function using an HTML form to populate a new message with some predefined text from an ASP string variable. I am using the syntax
<form action="MAILTO:someone@example.com?subject=<%= eSubject%>&body=<%= eBody%>" method="POST" enctype="text/plain">
where eSubject
and eBody
are string variables that have been drawn from values read from a DB and edited so that they use %20
instead of spaces and %0D%0A
to represent new lines. The form contains no inputs and uses JavaScript to simply submit it straight away.
I have researched possible problems with the length of the string I am trying to pass to the body text (e.g. Limit on mail body when posting a mailto: form), but I get the impression it is up to a browser and only becomes an issue at fairly high character counts (depending on my inputs this varies between ~380 and 400 for my eBody
string but is never more than 400).
The thing that is most frustrating is that my subject string (one line) populates the subject line of the new email as required. Could it be something to do with attempting to use newlines within my string? An example of the subject line is:
Query%20-%20Birmingham%20-%2025/03/2015%20at%2013:30
to produce subject line
Query - Birmingham - 25/03/2015 at 13:30
I am well aware that the general response to questions about using mailto
is "Why are you doing that?!", but for in this case it is appropriate as the idea is to create an email that will always contain eBody
(some info that is sent to customer services to show exactly what was happening at the moment of sending the query) and a message from the person sending the email, which will be different every time.
Any constructive help would be hugely appreciated. Thanks