· 6 years ago · Feb 08, 2020, 02:14 PM
1<head>
2 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
3</head>
4<div id="content1" style="display: none;"><?php
5 //GET THE EMAIL OF THE USER HERE
6<div id="content2" style="display: none;"><?php
7 //GET THE CODE THAT THEY CAN USE HRERE
8 ?></div>
9<script>
10 var email = $.trim(document.getElementById('content1').textContent);
11 var code = $.trim(document.getElementById('content2').textContent);
12 var key = "API KEY";
13 var url = "https://api.smtp2go.com/v3/email/send";
14 $.ajax({
15 url: url,
16 method: 'POST',
17 headers: {'Content-Type': "application/json"},
18 data: JSON.stringify({
19 'api_key': key,
20 'sender': "info@martinnaj.co.uk",
21 'to': [ email ],
22 'subject': "Your Confirmation Code",
23 'html_body': "EMAIL BODY"
24 }),
25 }).done(function(result) {
26 console.log(result);
27 }).fail(function(err) {
28 throw err;
29 });
30 window.onload = function(){
31 setTimeout(function () {
32 window.location.href = "../";
33 }, 1500);
34 }
35</script>