find error at send mail

I cannot find any error but the server says there is a error line
1, please solve it

function mail(){     
   $mail_date = date('l dS of F Y h:i:s A');     
   $email_url = $_SERVER['PHP_SELF'];     
   $email_ip = $_SERVER['REMOTE_ADDR'];     
   $to = '[email protected]';    
   $subject2 = "Email Subject";     
   $email = "The following page, $email_url , was accessed.     IP: $email_ip       Date: $mail_date     This is an automated email! DO NOT REPLY!";
   $from = "[email protected]";     
   $headers1 = "MIME-Version: 1.0rn";     
   $headers1 .= "Content-type: text/html; charset=iso-8859-1rn";     
   $headers1 .= "To: ".$to."rn";     
   $headers1 .= "From: ".$from."rn";     
   $headers1 .= "Reply-To: ".$from."rn";     
   mail($to, $subject2, $email, $headers);

Admin Edit: Adjusted code so it’s segmented into multiple lines for readability. Posting the entire code block in one line is not a good way to ask for assistance, nor does it make the code readable.

For one, don’t name your function ‘mail’, as mail has already been defined.

What errors do you get? What have you tried to fix the problem?

This is basically a ‘can you fix my script’ request, which is pretty much not-done here. See the Posting Guidelines for more information.

As Zyppora stated DON"T use MAIL as the name of you function. Now that it’s broken out into a more readable format, you can see that this WOULD be (if it would work) a RECURSIVE function. As at the end of YOUR mail function, it calls… well, the mail function. Since there is nothing in the function that would allow it to break out, it would be an infinite loop.

Rename the mail function to something more unique such as

[php]function my_mail(){ [/php]

Next try it out. If you are still getting errors, please let us know what those errors are and what you have done to try and resolve it. The more complete information that you give the better an answer you will get.

Sponsor our Newsletter | Privacy Policy | Terms of Service