HTML HTML Basics Going Further with HTML Link to Email

Enemuo Felix
Enemuo Felix
1,895 Points

Different syntax ?

I just clicked on the two links on the Teachers Note and found out that there might be different syntax for the mailto attribute. I found this

<a href="mailto:someone@yoursite.com?cc=someoneelse@theirsite.com&bcc=lastperson@theirsite.com&subject=Big%20News&body=Body-goes-here">Email Us</a>

And this

<a href="mailto:nowhere@mozilla.org?cc=name2@rapidtables.com&bcc=name3@rapidtables.com&amp;subject=The%20subject%20of%20the%20email &amp;body=The%20body%20of%20the%20email">
  Send mail with cc, bcc, subject and body
</a>

I noticed the second one has &amp; between the bcc value and subject while the first one only has the 'and' sign. Is there any difference?

1 Answer

Matt Brock
Matt Brock
28,305 Points

Yes, there's a difference. &amp; is the special character for the ampersand (&). The special character, &amp;, will still work in an email link. Check this out: https://codepen.io/mattpbrock/pen/JOXXPM.

Enemuo Felix
Enemuo Felix
1,895 Points

Thank you so much Sam, I just checked out your link. However, I noticed you might have made a mistake because your "using a special character" and "without special character" have the same syntax.