Emailing to multiple recipients with html Mailto: not working
Asked Answered
S

9

19

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:[email protected],[email protected]@email.com'>open emails</a>

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

Sycophant answered 14/2, 2012 at 14:11 Comment(4)
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?Omnibus
Why on earth do you require a mailto: with hundreds of addresses??? It's definitely not what mailto was designed for.Tupper
@Tupper 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.Nombril
Jus to be clear an example use case is where a single admin needs to send a quick email to 100s of recipients.Nombril
G
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.

Glaze answered 16/8, 2012 at 15:10 Comment(1)
Here is the more recent specification: tools.ietf.org/html/rfc6068#section-2Underclay
J
22

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:[email protected];[email protected];[email protected]'>Contact us</a>

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

<a href='mailto:[email protected];[email protected];[email protected]?subject=Webpage contact'>Contact us</a>
Joella answered 17/4, 2015 at 17:56 Comment(3)
This doesn't seem to work in gmail, it wants the addresses separated by a comma.Purington
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.Underclay
It seems that Gmail accepts both.Samira
G
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.

Glaze answered 16/8, 2012 at 15:10 Comment(1)
Here is the more recent specification: tools.ietf.org/html/rfc6068#section-2Underclay
M
4

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

Refrence here

Monge answered 14/2, 2012 at 14:22 Comment(0)
K
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

Kant answered 14/2, 2012 at 14:19 Comment(1)
Greetings, your comment was usefull but i also found this page topliners.eloqua.com/community/do_it/blog/2013/11/08/… where the pretend the opposite.Goshorn
B
1

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

Brack answered 14/2, 2012 at 15:25 Comment(0)
N
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:[email protected][email protected]

mailto:[email protected]?subject=This%20is%20the%20subject&[email protected]&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.

Nombril answered 6/10, 2014 at 13:41 Comment(0)
I
1
mailto:[email protected][email protected]&[email protected]&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.

Immigrant answered 4/11, 2021 at 11:7 Comment(1)
Thanks, this worked perfectly for me. I think that, as of 2024, this is the best solution, especially if you're making a mobile-only PWA.Real
T
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:[email protected]%[email protected]?subject=THIS%20IS%20AWESOME
Tall answered 20/10, 2017 at 16:57 Comment(0)
S
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.)

Spavin answered 1/8, 2021 at 17:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.