Jump to content

Mail Function


redgunner

Recommended Posts

$mail = mysql_real_escape_string($_POST['emailaddress']);
$headers = 'From: ' .$mail . "\r\n" .
   'Reply-To: ' . $mail . "\r\n" .
   'X-Mailer: PHP/' . phpversion();

 

@Garethp -

mysql_escape_string() has been deprecated.

Warning

This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.

click

Link to comment
Share on other sites

$mail = mysql_real_escape_string($_POST['emailaddress']);
$headers = 'From: ' .$mail . "\r\n" .
   'Reply-To: ' . $mail . "\r\n" .
   'X-Mailer: PHP/' . phpversion();

 

@Garethp -

mysql_escape_string() has been deprecated.

Warning

This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.

click

 

I'll stop using it when I have an alternate that does not rely on a database connection. When I use a database, I'll use real escape, but as a force of habit I use mysql_escape_string(); to sanatize even when I don't have Database needs

Link to comment
Share on other sites

$Mail = mysql_escape_string($_POST['emailaddress']);

 

Uh... might I ask why you're doing that?

 

Force of habit I guess. I 'spose it'd be easier to just do FROM: $_POST but when I started off I had some real problems with MySQL and Post functions unless I predeclared them first and used the alternative var. Since then it's just been a habit

Link to comment
Share on other sites

add:

 

$headers = 'From: $emailaddress' . "\r\n" .
   'Reply-To: $emailaddress' . "\r\n" .
   'X-Mailer: PHP/' . phpversion();
$emailaddress = $_REQUEST['emailaddress'] ;

 

You'd now have to add emailaddress as the field name for the email address on the previous page.

Link to comment
Share on other sites

$Mail = mysql_escape_string($_POST['emailaddress']);

 

Uh... might I ask why you're doing that?

 

Force of habit I guess. I 'spose it'd be easier to just do FROM: $_POST but when I started off I had some real problems with MySQL and Post functions unless I predeclared them first and used the alternative var. Since then it's just been a habit

 

One that you should drop. Its of absolutely no benefit.

Link to comment
Share on other sites

add:

 

$headers = 'From: $emailaddress' . "\r\n" .
   'Reply-To: $emailaddress' . "\r\n" .
   'X-Mailer: PHP/' . phpversion();
$emailaddress = $_REQUEST['emailaddress'] ;

 

You'd now have to add emailaddress as the field name for the email address on the previous page.

 

Won't work. Variables won't be interpolated in single quote delimited strings.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.