JohnSmith1999
JohnSmith1999

Reputation: 3

HTML link to user's email with form? like craigslist "reply"

I'm working on a small project for my personal website. I've looked around Stack Overflow and Google and haven't found many answers.

My goal: I'm trying to take an image and make it a hyperlink to open a user's default email client on their smartphone or PC. Just like, the Craigslist "reply" button directs you to your personal email client with the destination and subject already pre-filled out.

Example Image

Is this something I could do using strictly using HTML?

Any code or links are greatly appreciated.

Upvotes: 0

Views: 398

Answers (2)

JohnSmith1999
JohnSmith1999

Reputation: 3

I found an easier way to do this... just make a hyperlink with this information and it works perfectly...

https://mail.google.com/mail/u/0/?view=cm&fs=1&to=[ENTER DESTINATION EMAIL HERE]&su=[ENTER SUBJECT HERE]&body=%0A%0A[ENTER BODY MESSAGE HERE]%0A&tf=1

Upvotes: 0

Edward
Edward

Reputation: 2359

I'm not sure if you have even tried anything but it's very simple:

User's email is: [email protected].

<a href="mailto:[email protected]">Reply</a>

You can also make the user's email dynamic. Here's an example using PHP:

$email = // get the user's email in the database or whatever you want

<a href="<?php echo $email; ?>">Reply</a>

You can also set the email subject and/or body when they click that link. Here's an example with the email subject and body set:

<a href="mailto:[email protected]?subject=Message Subject&body=Hi, this is just the body of the email.">Reply</a>

Upvotes: 1

Related Questions