View Full Version : mail() and header() clashing

09-23-2005, 12:52 PM

I am using 2 headers on a page.

mail("$recipient", "$subject", "$forminfo", "From: $contactEmail\r\nReply-to:$contactEmail");

header("Location: http://www.c-digital.co.uk/pertemps/thanks.php");
Is that allowed?

I keep getting an error message:
Warning: Cannot modify header information - headers already sent by (output started at /jobs/jobs_card/jobs_card_mail.php:1) in jobs/jobs_card/preview_jobs.php on line 45

09-23-2005, 01:13 PM
Comment out your mail function.
Same error?
Solution is simple, you have previous output to the browser. Use output_buffering to prevent, but assuming that using header for a location change, you don't need to display output at all. Just remove whatever output is currently there.

09-23-2005, 02:23 PM
I doubt it has anything to do with your mail() function. Either you have already output html on line45 or you have opened and closed your php tags leaving white space in between