DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 966,155 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
etcroot
etcroot

Posted on

Dynamically Using mailto:

If you want to use mailto: tag when you're handling emails you can do this simple trick to make life easier for the consumers.

Been using mailto: the normal way until I found out you can actually customize it way more.

Here's what I use for my site (Slightly edited to not advertise)

`mailto:${contact}?subject=Application for ${title}&body=Hi ${username}, I am interested in your listing for ${title} that I found listed on [R E D A C T E D]. I would like to know more about it.`
Enter fullscreen mode Exit fullscreen mode

The queries you're able to use are:

  • mailto: (to set the recipent, you can separate this with commas)
  • &subject= (this will set the subject for the email, use URL encoding if you're sending long messages)
  • &body= (Same as subject but instead you're setting the actual email message)
  • &cc= (Setting CC recipents)
  • &bcc (Setting BCC recipents)

Hope this helped!

Top comments (0)

This post blew up on DEV in 2020:

js visualized

πŸš€βš™οΈ JavaScript Visualized: the JavaScript Engine

As JavaScript devs, we usually don't have to deal with compilers ourselves. However, it's definitely good to know the basics of the JavaScript engine and see how it handles our human-friendly JS code, and turns it into something machines understand! πŸ₯³

Happy coding!