-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathask.php
54 lines (45 loc) · 1.33 KB
/
ask.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<?php include('skeleton.php'); ?>
<div id="maincontentAsk">
<h2 id="askheader"> Questions? Comments? Reviews? Email us here.</h2>
<div id="askform">
<?php
include ('vendor/autoload.php');
$sendgrid = new SendGrid('[email protected]', 'nfi772ms');
$mail = new SendGrid\Mail();
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$mail->
addTo('[email protected]')->
setFrom($_REQUEST['email'])->
setFromName($_REQUEST['name'])->
setSubject($_REQUEST['subject'])->
setText($_REQUEST['message'])->
setHtml($_REQUEST['message']);
$sendgrid->
smtp->
send($mail);
echo "<h2>Thank you for your submission! We will respond to your email shortly.</h2>";
}
else
//if "email" is not filled out, display the form
{
echo "<form id='askformphp' method='post' action='ask.php'>
Name: <input id='namebox' name='name' type='text'><br>
Email: <input id='emailbox' name='email' type='text'><br>
Subject: <input style='margin-bottom: 1em' name='subject' type='text'><br>
Message:<br>
<textarea name='message' rows='15' cols='118'>
</textarea><br>
<input type='submit'>
</form>";
}
?>
</div>
</div>
<?php include('footer.php'); ?>
</body>
</html>