Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('../lib/phpmailer/class.phpmailer.php');
- require_once('../config.php');
- if (!empty($_POST['name']) && !empty($_POST['email']))
- {
- $output_text = "Name : {$_POST['name']}\nEmail : {$_POST['email']}";
- $newmailer = new phpmailer();
- $newmailer->IsSMTP();
- $newmailer->Host = $config['smtp_host'];
- $newmailer->SMTPAuth = true;
- $newmailer->Username = $config['smtp_username'];
- $newmailer->Password = $config['smtp_password'];
- $newmailer->Port = $config['smtp_port'];
- $newmailer->WordWrap = 70;
- $newmailer->Debug = 2;
- // configure the message
- $newmailer->From = $config['smtp_from'];
- $newmailer->FromName = 'EpixHD';
- $newmailer->AddAddress('freeforall@epixhd.com','freeforall');
- $newmailer->IsHTML(false);
- $newmailer->Subject = "Free For All Newsletter Signup";
- $newmailer->Body = $output_text;
- if (!$newmailer->Send())
- {
- $response = array('success' => false, 'message' => 'Couldn\'t submit entry');
- } else {
- $response = array('success' => true,'message' => 'Thanks for signing up for the newsletter!');
- }
- } else {
- $response = array('success' => false, 'message' => 'Please enter your name and a valid email address.');
- }
- $handlers = ob_list_handlers();
- for ($cnt = 0; $cnt < sizeof($handlers); $cnt++) { ob_end_clean(); }
- header("Cache-Control: no-cache, must-revalidate");
- header('Content-Type:application/json');
- $length = strlen(json_encode($response));
- header('Content-Length:'.$length);
- echo json_encode($response);
- exit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement