OK, so who said this was going to be
Having initially sorted out the ‘Great Mailto Mystery‘ (thanks to some considerable patience on the part of my design partner Peter). But then they began to fail again – I’d hit the 2K limit.
As I said in my previous post there is a general limit on the length of urls in IE of 2083 characters and this, of course, applies to mailtos – a particular form of url.
My eTimesheet application provides a facility to email (or SMS) all the freelancers working in a particular period (usually a week but also during any search period). This list is created during the iteration through the array of bookings, so it contains duplicates where freelancers work for more than one client in that week. I had failed to clean up the list, instead relying (unconsciously) on the generosity of others i.e. mail servers are not as dumb as me and don’t send the same email twice when there are duplicates in the Bcc list.
Being self-taught in PHP (a little learning is certainly a dangerous thing!) I tend to learn this stuff as I go and in response to actual need. I had therefore managed to overlook the array_unique function (along with dozens of its friends). So, having built my (semi-colon separated) list of emails, I needed to de-duplicate:
... $working_emails = explode(';',$working_emails); $working_emails = array_unique($working_emails); $working_emails = implode(';',$working_emails); ...
A shorter url, and all was well with the world – at least until someone wants to email everyone who worked last year …
Or there are more than about 80 people to email (I have average email length of around 24 characters but see this post for a higher figure).
I need a generic solution!