Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

Send mail issue: Undefined variable: HTTP_POST_VARS

the mail() function

Moderators: macek, egami, gesf

Send mail issue: Undefined variable: HTTP_POST_VARS

Postby totoleheros » Fri Oct 12, 2012 9:18 am

Hello,

I recently moved my website to a new server.
This is a one page website with a mainly a contact form using an invite.php email form
Since I moved to the new server, everytime the user inputs his name and email it returns this page:
Notice: Undefined variable: HTTP_POST_VARS in /home/xxx/public_html/landing/invite.php on line 19 Notice: Undefined variable: HTTP_POST_VARS in /home/xxx/public_html/landing/invite.php on line 20 Notice: Undefined variable: HTTP_POST_VARS in /home/xxx/public_html/landing/invite.php on line 24

Here is the invite.php file.

Would you have any idea what is wrong? I am using PHP 5.3.2.
Many thanks in advance for your feedback

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
require("./PHPMailer/class.phpmailer.php"); // path to the PHPMailer class
include_once $_SERVER['DOCUMENT_ROOT'] . '/landing/securimage/securimage.php';
$securimage = new Securimage();
$mail->image=$securimage;
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Mailer = "smtp";
$mail->Host = "smtp.mail.yahoo.com";
$mail->Port = 587;
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "xxxxxl@yahoo.com"; // SMTP username
$mail->Password = "xxxx"; // SMTP password
$mail->From = "xxxx@yahoo.com";
$mail->AddAddress("xxxx@yahoo.com");
$mail->Subject = $HTTP_POST_VARS["name"];
$mail->Body = $HTTP_POST_VARS["email"];
$mail->WordWrap = 50;
$name = $_POST["name"];
$mail->Name = $name;
$email = $HTTP_POST_VARS["email"];
$mail->Content = $email;
if (!preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s]+\.+[a-z]{2,6}))$#si', $email)) {
echo "<h4>The email address entered is not valid</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($name == "") {
echo "<h4>Oops...you forgot to insert your name</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($securimage->check($_POST['captcha_code']) == false) {
echo "The security code entered was incorrect.<br /><br />";
echo "Please go <a href='javascript:history.go(-1)'>back</a> and try again.";
exit;
}
elseif(!$mail->Send()) {
echo 'Invitation request was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo '<h1 align="center" style="font-family:Helvetica;font-size:32px;font-weight: 300">Great! We will send you an invite as soon as we are ready for Beta</h1>';
}
?>
totoleheros
New php-forum User
New php-forum User
 
Posts: 14
Joined: Fri Mar 30, 2012 12:09 am

Re: Send mail issue: Undefined variable: HTTP_POST_VARS

Postby seandisanti » Fri Oct 12, 2012 9:44 am

use $_POST super global instead of HTTP_POST_VARS.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Send mail issue: Undefined variable: HTTP_POST_VARS

Postby totoleheros » Fri Oct 12, 2012 9:56 am

Hi Sean,

Many thanks. It's working great.!
totoleheros
New php-forum User
New php-forum User
 
Posts: 14
Joined: Fri Mar 30, 2012 12:09 am

Re: Send mail issue: Undefined variable: HTTP_POST_VARS

Postby seandisanti » Fri Oct 12, 2012 10:46 am

no problem, i'm glad i could help.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 8 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron