NYCPHP Meetup

NYPHP.org

[nycphp-talk] How to override header info in mail

Analysis & Solutions danielc at analysisandsolutions.com
Sat Nov 30 14:19:06 EST 2002


Phil:

On Sat, Nov 30, 2002 at 01:00:38PM -0500, Phil Powell wrote:

> if (!mail($to, $subject, $body, "From: " . $from . ";" .
> header("Content-type " . $contentType))) {..}

> to use the mail() function in PHP to send simple text/plain or text/html
> email.  However, upon attempting to send I get a warning message
> indicating that header information has already been set prior to 
> emailing.

You are combining two completely different functions.  mail() is to send
email.  header() is for HTTP headers while serving/viewing pages on a
webserver.

If you want to put content type headers in your email, you just type them 
in, don't use the header() function.

--Dan

-- 
 The new Department of Homeland Security is exempt from:
    * the Freedom of Information Act   * procurement rules
    * labor collective bargaining      * whistle blower protection
 The real goal?  Eliminating government accountability.



More information about the talk mailing list