16

we have 400 to 500 hundred emails, when we concatenate them and put them in mailto: it does not work, browser automatically adds "..." in between emails and clicking link does not work.

<a href='mailto:one@email.com,two@email.com....400@email.com'>open emails</a>

Is there a maximum length on mailto: attribute ? is there any other way i can open multiple emails ?

Salman Aziz
  • 351
  • 1
  • 2
  • 10
  • 2
    It seems odd that you would use mailto: to send to so many addresses at once. Is there a reason you wouldn't just use a back end mail script to accomplish this? – Maxx Feb 14 '12 at 14:17
  • 3
    Why on earth do you require a mailto: with hundreds of addresses??? It's definitely not what mailto was designed for. – adelphus Feb 14 '12 at 14:17
  • 3
    @adelphus I think there is a use case here, you could have a solution to a problem in minutes, whereas it would take much longer to set up a server side solution. – chim Oct 06 '14 at 13:43
  • 1
    Jus to be clear an example use case is where a single admin needs to send a quick email to 100s of recipients. – chim Oct 06 '14 at 13:45

9 Answers9

18

If you need to email more than one (but not hundreds), the correct form should not have spaces but should have semicolons (especially if the users will likely use Outlook).

<a href='mailto:one@email.com;two@email.com;three@email.com'>Contact us</a>

If you want to automatically include a subject line add "?subject=This is the subject"

<a href='mailto:one@email.com;two@email.com;three@email.com?subject=Webpage contact'>Contact us</a>
webdeb
  • 181
  • 1
  • 3
  • This doesn't seem to work in gmail, it wants the addresses separated by a comma. – mekane84 May 01 '17 at 16:07
  • 4
    Outlook wants `;` while everything else wants `,`. The specification is `,`... so outlook is broken and hasn't been fixed for years, and there is no way for you to know what client the user is using so thats pretty cool. – justin.m.chase Mar 13 '20 at 02:52
  • It seems that Gmail accepts both. – Tam Jan 13 '22 at 15:03
11

Just to add a bit more detail... What RFC 1738 actually says is

A mailto URL takes the form:

    mailto:<rfc822-addr-spec>

where is (the encoding of an) addr-spec, as specified in RFC 822 [6].

and while RFC2822 may have subsumed RFC822, RFC2822 does not change the addr-spec specification (section 3.4.1) as

 addr-spec   =  local-part "@" domain

More specifically, RFC 1738 does not say the URL takes the form of an RFC822 Address Specification but directly says the encoding of an addr-spec.

It is true that in RFC2822, section 3.4 Address Specification, the definition of group is modified from, in RFC822,

 group       =  phrase ":" [#mailbox] ";"

 mailbox     =  addr-spec                    ; simple address
             /  phrase route-addr            ; name & addr-spec

to

 group           =       display-name ":" [mailbox-list / CFWS] ";"

 display-name    =       phrase

 mailbox-list    =       (mailbox *("," mailbox)) / obs-mbox-list

 mailbox         =       name-addr / addr-spec

which does allow multiple addr-specs, but again, the definition of an addr-spec itself remains unchanged.

I would conclude, then, that while it might work, it is not officially supported.

Pendantic
  • 142
  • 1
  • 2
4

The maxlength 2048 (if you are using Internet Explorer). I think you might what to reconsider you solution.

Refrence here

Arion
  • 31,011
  • 10
  • 70
  • 88
1

Depending on your use case, it might be possible to send an email from the browser like this, but it relies on the user having set up the protocol handler for mailto properly.

For a limited number of users e.g. a few site administrators this could be a good solution. As you can control the set up of the client machine and make sure that it works.

So if you created a page with this link

mailto:me@example.com?bcc=someone_else@example.com

mailto:someone@example.com?subject=This%20is%20the%20subject&bcc=someone_else@example.com&body=This%20is%20the%20body

Cut and paste in to the address bar to test if this will work on your machine.

I wouldn't recommend this as a robust solution for any good software product, you should use a server based solution. But if you need something to help with internal systems, or just for a personal site, then this will take minutes and cause fewer headaches then server based solutions.

There are many many options for sending email, I think this one is simple, quick and flexible, but it will not work on all machines, maybe only 70%???

One last thing, usually if you are sending emails to multiple recipients send it to yourself and use the Blind Carbon Copy field (bcc) This means that your not sharing your customers' email addresses with all of your other customers.

tl;dr

To summarise, if you can test/troubleshoot every single client machine that will use the email link, then consider using a complicated mailto link. Otherwise go for a server side email.

And use the Bcc field for mass emails.

chim
  • 8,407
  • 3
  • 52
  • 60
1

Its a bad practice, its barely possible. Try to rethink your script.

RFC 1783 (URLs) says that a mailto: URL takes an RFC822 address specification. RFC822 is obsoleted by RFC2822; and RFC2822 says that an address specification can include a mailbox-list, which is a comma-separated list of mailboxen. I conclude that what you are trying to do is permitted.

However UA support for "mailto:" is at best patchy; the recommendation is to avoid it completely, or failing that restrict yourself to specifying a single address.

Attempting to include a subject, in particular, will definitely not work in all UAs. Also note that

It is much better to use a formmail script. That will give you the kind of versatility you appear to want, while completely sidestepping the mailto: URL scheme, the deficient browser support that it implies, and the question of whether any email UA is configured in the first place.

credits: http://bytes.com/topic/html-css/answers/496355-multiple-addresses-mailto

mas-designs
  • 7,498
  • 1
  • 31
  • 56
  • Greetings, your comment was usefull but i also found this page http://topliners.eloqua.com/community/do_it/blog/2013/11/08/how-to-customize-mailto-for-multiple-recipients-subject-and-body-in-html-codes-with-samples where the pretend the opposite. – Milche Patern Sep 19 '14 at 18:21
1

You should create a Distribution List and add all of these emails to this list. http://support.microsoft.com/kb/284292

Hanlet Escaño
  • 17,114
  • 8
  • 52
  • 75
0

I would suggest a DG for this many people but email addresses are not separated by commas but instead semicolons. I have read some people have issues using semicolons in their mailto line. Try encoding the semicolon as %3B, much like you would encode a space as %20.

For example,

mailto:someone@somewhere.com%3Banother@thatplace.com?subject=THIS%20IS%20AWESOME
AxGryndr
  • 2,274
  • 2
  • 22
  • 45
0

Use the bcc= query instead. It supports multiple comma-separated emails and the recipients will not see other recipients in contrast to to main receiver which reveals all other To: addresses (and also sends a reply to EVERYONE in that list.)

0
mailto:one@example.com?to=two@example.com&to=three@example.com&cc=...

I cannot find the 'to' field in official documentation, but it seems to work for more email clients than using separators like commas or semicolons.

It works as hoped on outlook mobile, gmail mobile, apple mail and thunderbird. On Windows 10 built-in mail app, it only added the last 'to' address as a main recipient, the others were likely overwritten. In any case this is an upgrade for our users who previously encountered an 'invalid email address' error.