This lesson is exclusive to members

Responsive Web Design Essentials - HTML5 CSS3 Bootstrap

How to add a simple email button to a website using mailto in HTML

Daniel Walter Scott

Download Exercise Files Download Completed Files

Contents

Certificates

We’re awarding certificates for this course!

Check out the How to earn your certificate video for instructions on how to earn yours and click the available certificate levels below for more information.

Introduction

I recommend hosting your new website with Bluehost, you can get a big discount by signing up with this link: https://www.bluehost.com/track/byol/byol_webess_30

You need to be a member to view comments.

Join today. Cancel any time.

Sign Up
Hi there, this video is all about adding a really simple email button to a website. We had this link that we made earlier, and when we clicked it, it went to Google. That wasn't that helpful, what we want to do now is, when we click it, it opens up our email campaign, and since there's a website, pre-fills in. And the Subject Line's done. It's a nice little handy quick, super easy, quick trick to add that sort of functionality to your website. Let's jump in and make it happen. 

All right, to make it work we're going to do it to the button that we've got here. At the moment, it doesn't-- goes to Google, or it will go to another web page. I want to get it so that when you click it-- so I'm the user, I'm at this website at Adare, and I want to click it, and send an email about a reservation. Doing a form, we'll do later on in the course, because it's pretty hard to do, not pretty hard, yeah it is pretty hard. We'll do it later on, but for the moment a little 'mail to' thing is going to be nice and simple, and quick and easy to do. 

So all we need to do is, we did this href earlier on. If you haven't done this one, look for making a hyperlink video, earlier on. And all we need to do is switch out this part. So instead of going to google.com, we're going to get it to go to 'mail to:' So it has to look exactly like this. Then you put in the email address, no spaces. So if you wanted to email me, you'd email daniel@ my website. mywebsite.com

So when somebody clicks that, they're going to-- we'll show it, target = blank. Yeah, why not? Doesn't really matter in this case, because it will load up in its own blank thing. And that is it, that should make it work. All right, let's save it, let's give it a preview. Where are you? Cool. Let's click it, oh, look at that. It opened up my email system on my machine. I'm pretending I'm the client now. So I'm just searching the internet for a restaurant. I'm like, "Oh, let's make a reservation." Click the button, this opens up. So it's opening up Mail, and wants to-- I can write a subject and I could say, "Could I get a booking?" 

It's a nice cheap, easy quick way, so there's five seconds to implement, and seems easier than a form. A couple of things that might be handy is to add a subject line, like pre-filling it in. So what you can do, you can add a little bit of extra to the end of this. So 'mail to' is cool, but at the end of the .com put in a question mark. You got to put a question mark, and it has to be spelt, like a capital S, and it has to be subject. So question mark, capital S for subject, and then you can put it in equals, '=' 

So it all has to look exactly like that. Then you can just add the subject line, so you could say, 'Reservation'. Let's hit 'Save'. Let's preview it, let's close it down. Let's preview it in the browser. Let's click on it. You can see, it loaded my email and put the subject in; cool, huh? You can do some other things like adding the CC, and can you put Body Copy in? I think you can as well. I don't know them off by heart, but you can go and have a look at that yourself. 

Now all you need to really look for is, search for 'mail to' in HTML. And you'll find a page on what you can, and can't add. Just be different things like this. I imagine it will be question mark, cc equals, and you put in another email address, but that's a guess. Just a nice little cheap trick for adding an email. 

All right, that's it for this one. Let's get into the next one. If you're thinking, "That will be the last one for tonight", or, "I'll do some more tomorrow", do the next one, the next one's awesome. Embed Codes, it's going to make us look awesome, it's that map. It's not going to take too long. All right, I'll either see you in a few seconds, or I'll see you tomorrow when you wake up. All right, bye now.