<? require "vendor/autoload.php"; use Mailgun\Mailgun; $client = new \Http\Adapter\Guzzle6\Client(); $mailgun = new \Mailgun\Mailgun("key-bc4ddd510e0d9c6715dc581bb720b7ce", $client); $domain = "mg.resultsci.com"; $name = htmlspecialchars($_POST["name"]); $email = htmlspecialchars($_POST["email"]); $execution_insight = isset($_POST["execution-insights"]); $whitepaper = isset($_POST["whitepaper"]); $playbook = isset($_POST["playbook"]); $assessment = isset($_POST["assessment"]); $chat = isset($_POST["chat"]); $admin_email = "*****@*****.**"; $admin_subject = "Advertising Campaign Connection"; $admin_body = " <p>Name: " . $name . "</p> <p>Email: " . $email . "</p> "; if (!$execution_insight && !$whitepaper && !$playbook && !$assessment && !$chat ) { echo "Please select an option"; return; }
<?php require "vendor/autoload.php"; use Mailgun\Mailgun; $client = new \Http\Adapter\Guzzle6\Client(); $mailgun = new \Mailgun\Mailgun("key-bc4ddd510e0d9c6715dc581bb720b7ce", $client); $domain = "mg.resultsci.com"; if ($_SERVER["HTTP_X_REQUESTED_WITH"]) { $name = htmlspecialchars($_POST["name"]); $email = htmlspecialchars($_POST["email"]); $subject = htmlspecialchars($_POST["subject"]); $message = htmlspecialchars($_POST["message"]); $to = "*****@*****.**"; $mailgun->sendMessage($domain, array("from" => $name . " <" . $email . ">", "to" => "Tim O'Connor <" . $to . ">", "subject" => $subject, "html" => "<p>Connection Name: " . $name . "</p>" . "<p>Connection Email: " . $email . "</p>" . "<p>" . nl2br($message) . "</p>")); echo "success"; }