Re: Doubt in mail()

From: Date: Thu, 31 Aug 2000 06:36:51 +0000
Subject: Re: Doubt in mail()
References: 1 2 3  Groups: php.windows 
Request: Send a blank email to php-windows+get-2328@lists.php.net to get a copy of this message
Your code works fine on my linux box invoking plain old sendmail. I replaced your two recipient addresses with two completely seperate ones of my own and executed your code, and both emails arrived fine. One destination SMTP server was Post.Office on WinNT and the other was Qmail on Linux. The machine which sent the email from Php is Linux also, with no smtp server - only command line sendmail. I don't know what Php is doing on my machine when there are comma seperated values in the 'to' argument, but what you might try instead of stuffing multiple addresses into the first argument of mail(), is adding extra To: fields to the 4th argument of mail like this instead: $To = "vivek@madona.com"; $From = "vivekk@india.hp.com"; $moreto = "vivekk@india.hp.com"; $Headers = "From: " . $From . "\n"; $Headers .= "To: $moreto\n"; $Headers .= "MIME-Version: 1.0"."\n" ; $Headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; $Headers .= "Content-Transfer-Encoding: 8bit" . "\n"; $Headres .= "X-Mailer:PHP/".phpversion(); $message = "Test message, please ignore"; $sub = "Test Message, please igniore this mail"; mail($To,$sub,$message,$Headers); jason > Hi > Code is here. > Our SMTP server is unix box > > $To = "mailto:vivek@madona.com,vivekk@india.hp.com; > $From = "mailto:vivekk@india.hp.com; > $Headers = "From: " . $From . "\n"; > $Headers .= "MIME-Version: 1.0"."\n" ; > $Headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; > $Headers .= "Content-Transfer-Encoding: 8bit" . "\n"; > $Headres .= "X-Mailer:PHP/".phpversion(); > $message = "Test message, please ignore"; > $sub = "Test Message, please igniore this mail"; > > mail($To,$sub,$message,$Headers); > > The mail is returning back to me, The error is > > The Postfix program > <vivekk@madona.com, vivekk>: bad host/domain syntax: "madona.com, vivekk" > > > > Jason Brooke wrote: > > > Copy and paste the exact part which is failing > > > > jason > > > > > Hi > > > I am using Apache 1.3.9 and PHP 3.0.11 on WinNT4.0. > > > mail() function is working fine for one email address but it is failing > > > for multiple address. > > > I tried all combinations for separating the recipients, mail will just > > > come back to me. > > > i.e., comma, space, pipe.. nothing seems to be working. Will PHP 3.0.11 > > > supports multiple recipients? > > > > > > regards > > > Vivek K > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.windows (#2328) next »