-2

First of all, thanks in advance for considering my question.

I'm pretty new to html/js, so I was wondering if it would be possible to get help on making a button on my website that completes the following:

  1. Opens a random link from a list of links in a new tab
  2. Sends an email notification to me that the button has been clicked, without any window popping up on the client's side (and maybe tells me what link has been used)
  3. And looks pretty :)

I'm using Weebly to put most of my website together, so it might be difficult to use some of the server side commands or other things like that. I do believe I have the option to use php, html, javascript, and anything else that I can embed onto an html file.

Anyways, thanks!

geger42 _
  • 15
  • 5
  • Hi, I notice that you have PHP added as a tag. Do you have the ability to place PHP files on your website? – Michael Thompson Jan 20 '17 at 02:00
  • Here is a post that may give you the answer. http://stackoverflow.com/questions/7381150/how-to-send-an-email-from-javascript – Shiping Jan 20 '17 at 02:08
  • 2
    Hi @geger42 and welcome to the site! This question is definitely to broad for Stackoverflow's question model, since it pretty much asks for a solution to a complete feature on a website (which includes dealing with client code, design, email server and/or analytics...). See http://stackoverflow.com/help/dont-ask for more information. I suggest you break this into much smaller pieces (e.g. how to receive an email when a button is clicked on a website?), providing information on your previous research on that topic. Hope that helps :) – Christian Rondeau Jan 20 '17 at 02:09
  • 1
    [so] is *not* a free code writing service. You are expected to try to **write the code yourself**. After [doing more research](http://meta.stackoverflow.com/questions/261592) if you have a problem you can **post what you've tried** with a **clear explanation of what isn't working** and providing a [**Minimal, Complete, and Verifiable example**](http://stackoverflow.com/help/mcve). I suggest reading [ask] a good question and [the perfect question](http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/). Also, be sure to take the [tour]. – John Conde Jan 20 '17 at 12:33

1 Answers1

0

You cannot send an email from the computer that hosts the client/browser without the user knowing. That would open a huge security hole!!!!

Perhaps you should considered sending the email from the server side when the page (the target of the random link) is rendered.

John Wu
  • 50,556
  • 8
  • 44
  • 80