I have a mailto link in an anchor tag
<a href="mailto:?subject=Subject&body=Body">Email This</a>
The issue is that the Body parameter is a huge article, and there appears to be a character limit on the url.
Is there a way to get around the limit?
Is there a way to get around the limit?
Very hardly.
It is even probable that the limitations vary from browser to browser, or from E-Mail client to E-Mail client.
I would rather use a HTML form and a server-side script to send the message.
Yes, there is a limit on the length of the URL.
The limit varies from browser to browser, so you should keep the URL below 2000 characters to be safe.
Internet Explorer seems to be the browser that is having the shortest limit. According to this article it's 2083 characters.
Yes there are issues with Mailto tag it varies from browser to browser and email client to
email client . In case of this issues try server side script to overcome this issue . Mailto at times behaves very abnormal
I know this question is old, but I had a similar problem, hitting the limit as I needed to send the email into many recipients.
I came across this solution, but I don't understand why it works, I leave it here anyway
function sendEmails(emails) {
var timeout = 2000;
var mailtoPrefix = 'mailto:?bcc=';
var maxUrlCharacters = 1900;
var separator = ';';
var currentIndex = 0;
var nextIndex = 0;
if (emails.length < maxUrlCharacters) {
window.location = mailtoPrefix + emails;
return;
}
do {
currentIndex = nextIndex;
nextIndex = emails.indexOf(separator, currentIndex + 1);
} while (nextIndex != -1 && nextIndex < maxUrlCharacters)
if (currentIndex == -1) {
window.location = mailtoPrefix + emails;
} else {
window.location = mailtoPrefix + emails.slice(0, currentIndex);
setTimeout(function () {
sendEmails(emails.slice(currentIndex + 1));
}, timeout);
}
}
usage:
var emails = 'a@a.com;b@b.com;c@c.com';
sendEmails(emails);