RE: [PHP-DB] How to write errorhandling??
First, that "Failed to Connect" message looks like a database failure to connect message; nothing to do with mail() Second, are you REALLY trying to send header info at line 256? That's pretty far down in a program. Usually, those decsions are made within the first 10 to 20 lines. So, is line 256 the mail() line? I suspect that you previously output some text which would account for the "Warning: Cannot add header information - headers already sent by..." message Geben Sie uns mehr Information, bitte. -Original Message- From: Luditus [mailto:[EMAIL PROTECTED]] Sent: Sunday, October 21, 2001 5:45 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] How to write errorhandling?? Hi Folks, I would like to send an mail via the mail function. If the mail fails I would like to redirect to an errorpage. Currently my code looks like this: if ( mail($email,$subject_confirm_account, $message_confirm_account, $from_confirm_account) ){ HEADER("Location:index.php?fuseaction=txt&msg=registered"); //success } else{ HEADER("Location:index.php?fuseaction=txt&msg=mailproblem"); // mail could not been sent }; Unfortunatelly I get an erromessage like that: Warning: Failed to Connect in e:\projects\globosapiens\07_production\actual\account\include\user.php on line 256 Warning: Cannot add header information - headers already sent by (output started at e:\projects\globosapiens\07_production\actual\account\include\user.php:256) in e:\projects\globosapiens\07_production\actual\account\include\user.php on line 260 Where is the problem??? I can't see it. Maybe one of you guys could help me out. Thanx in advance, Luditus -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to write errorhandling??
Hi, I never said it is impossible to use mail() on a WIN machine - it just needs some additional adjustments of the php configuration file. For those who need more information on the topic check the user contributed notes at http://www.php.net/manual/en/ref.mail.php Regards Dobromir Velev -Original Message- From: DL Neil <[EMAIL PROTECTED]> To: Dobromir Velev <[EMAIL PROTECTED]>; [EMAIL PROTECTED] <[EMAIL PROTECTED]>; [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: Monday, October 22, 2001 2:29 PM Subject: Re: [PHP-DB] How to write errorhandling?? >Luditus/Dobromir, >It IS possible to run the mail function on a Win machine - I had a Win2000/IIS(with its own SMTP stub) box running PHP >mail happily. >Also it is possible to have a Win-with-no-local-SMTP configuration. I have re-jigged my WinNT portable to run the same >PHP/Apache script connecting directly to my ISP's SMTP server (in part using the path var mentioned). >I haven't tried to combine email with 'headers' though! >...if that's the problem... >=dn > > >> Hi, >> I see that everybody is looking for the error in the header function - but >> the error actually is that Luditus is trying to use mail on a Windows box >> with no SMTP server on it. >> It is possible to suppress the mail function output using @mail, but it >> won't fix the problem - if you want to use mail function on a WIN machine >> you'll need a sendmail like program and you will have to adjust the >> sendmail_path variable in your PHP configuration. >> >> >Hi Fokes, >> > >> >I would like to send an mail via the mail function. >> > >> >If the mail failes I would like to redirect to an errorpage. Currently my >> >code looks like this: >> > >> > if ( mail($email,$subject_confirm_account, $message_confirm_account, >> >$from_confirm_account) ){ >> > HEADER("Location:index.php?fuseaction=txt&msg=registered"); >> file://success >> > } >> > else{ >> > HEADER("Location:index.php?fuseaction=txt&msg=mailproblem"); // mail >> could >> >not been sent >> > }; >> > >> >Unfortunatelly I get an erromessage like that: >> > >> >Warning: Failed to Connect in >> >e:\projects\globosapiens\07_production\actual\account\include\user.php on >> >line 256 >> > >> >Warning: Cannot add header information - headers already sent by (output >> >started at >> >e:\projects\globosapiens\07_production\actual\account\include\user.php:256) >> >in e:\projects\globosapiens\07_production\actual\account\include\user.php >> on >> >line 260 >> > >> >Where is the problem??? I can't see it. > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to write errorhandling??
Luditus/Dobromir, It IS possible to run the mail function on a Win machine - I had a Win2000/IIS(with its own SMTP stub) box running PHP mail happily. Also it is possible to have a Win-with-no-local-SMTP configuration. I have re-jigged my WinNT portable to run the same PHP/Apache script connecting directly to my ISP's SMTP server (in part using the path var mentioned). I haven't tried to combine email with 'headers' though! ...if that's the problem... =dn > Hi, > I see that everybody is looking for the error in the header function - but > the error actually is that Luditus is trying to use mail on a Windows box > with no SMTP server on it. > It is possible to suppress the mail function output using @mail, but it > won't fix the problem - if you want to use mail function on a WIN machine > you'll need a sendmail like program and you will have to adjust the > sendmail_path variable in your PHP configuration. > > >Hi Fokes, > > > >I would like to send an mail via the mail function. > > > >If the mail failes I would like to redirect to an errorpage. Currently my > >code looks like this: > > > > if ( mail($email,$subject_confirm_account, $message_confirm_account, > >$from_confirm_account) ){ > > HEADER("Location:index.php?fuseaction=txt&msg=registered"); > file://success > > } > > else{ > > HEADER("Location:index.php?fuseaction=txt&msg=mailproblem"); // mail > could > >not been sent > > }; > > > >Unfortunatelly I get an erromessage like that: > > > >Warning: Failed to Connect in > >e:\projects\globosapiens\07_production\actual\account\include\user.php on > >line 256 > > > >Warning: Cannot add header information - headers already sent by (output > >started at > >e:\projects\globosapiens\07_production\actual\account\include\user.php:256) > >in e:\projects\globosapiens\07_production\actual\account\include\user.php > on > >line 260 > > > >Where is the problem??? I can't see it. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to write errorhandling??
That's correct. I've seen a discussion on dev phorum about embeding SMTP code in PHP, but as I remember the final decision was that SMTP code will stay outside of PHP code. -- Andrey Hristov Web Developer Icygen Corporation BUILDING SOLUTIONS http://www.icygen.com On Monday 22 October 2001 06:46 am, you wrote: > Hi, > I see that everybody is looking for the error in the header function - but > the error actually is that Luditus is trying to use mail on a Windows box > with no SMTP server on it. > It is possible to suppress the mail function output using @mail, but it > won't fix the problem - if you want to use mail function on a WIN machine > you'll need a sendmail like program and you will have to adjust the > sendmail_path variable in your PHP configuration. > > HTH > Dobromir Velev > > -Original Message- > From: Luditus <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] <[EMAIL PROTECTED]> > Date: Sunday, October 21, 2001 1:41 PM > Subject: [PHP-DB] How to write errorhandling?? > > >Hi Fokes, > > > >I would like to send an mail via the mail function. > > > >If the mail failes I would like to redirect to an errorpage. Currently my > >code looks like this: > > > > if ( mail($email,$subject_confirm_account, $message_confirm_account, > >$from_confirm_account) ){ > > HEADER("Location:index.php?fuseaction=txt&msg=registered"); > > file://success > > > } > > else{ > > HEADER("Location:index.php?fuseaction=txt&msg=mailproblem"); // mail > > could > > >not been sent > > }; > > > >Unfortunatelly I get an erromessage like that: > > > >Warning: Failed to Connect in > >e:\projects\globosapiens\07_production\actual\account\include\user.php on > >line 256 > > > >Warning: Cannot add header information - headers already sent by (output > >started at > >e:\projects\globosapiens\07_production\actual\account\include\user.php:256 > >) in > > e:\projects\globosapiens\07_production\actual\account\include\user.php > > on > > >line 260 > > > >Where is the problem??? I can't see it. > > > >Maybe one of you guys could help me out. > > > >Thanx in advance, > > > >Luditus > > > > > > > >-- > >PHP Database Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to write errorhandling??
Hi, I see that everybody is looking for the error in the header function - but the error actually is that Luditus is trying to use mail on a Windows box with no SMTP server on it. It is possible to suppress the mail function output using @mail, but it won't fix the problem - if you want to use mail function on a WIN machine you'll need a sendmail like program and you will have to adjust the sendmail_path variable in your PHP configuration. HTH Dobromir Velev -Original Message- From: Luditus <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: Sunday, October 21, 2001 1:41 PM Subject: [PHP-DB] How to write errorhandling?? >Hi Fokes, > >I would like to send an mail via the mail function. > >If the mail failes I would like to redirect to an errorpage. Currently my >code looks like this: > > if ( mail($email,$subject_confirm_account, $message_confirm_account, >$from_confirm_account) ){ > HEADER("Location:index.php?fuseaction=txt&msg=registered"); file://success > } > else{ > HEADER("Location:index.php?fuseaction=txt&msg=mailproblem"); // mail could >not been sent > }; > >Unfortunatelly I get an erromessage like that: > >Warning: Failed to Connect in >e:\projects\globosapiens\07_production\actual\account\include\user.php on >line 256 > >Warning: Cannot add header information - headers already sent by (output >started at >e:\projects\globosapiens\07_production\actual\account\include\user.php:256) >in e:\projects\globosapiens\07_production\actual\account\include\user.php on >line 260 > >Where is the problem??? I can't see it. > >Maybe one of you guys could help me out. > >Thanx in advance, > >Luditus > > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] How to write errorhandling??
does the file that you are trying to send an email from include() another file before that function? maybe a database connection fails or maybe you sent some headers in that by mistake... // -Original Message- // From: Luditus [mailto:[EMAIL PROTECTED]] // Sent: Monday, 22 October 2001 2:31 AM // To: [EMAIL PROTECTED] // Subject: Re: [PHP-DB] How to write errorhandling?? // // // Unfortunatelly this doesn't work at all. Same error. Any other ideas? // // Cheers // // Luditus // // // "Attila Strauss" <[EMAIL PROTECTED]> schrieb im Newsbeitrag // 01102113081306.00694@pluto">news:01102113081306.00694@pluto... // > hi // > // > do an // > // > exit; // > // > after the header(); // > // > cu // > attila // > // > // > // > On Sunday 21 October 2001 12:45, Luditus wrote: // > > Hi Fokes, // > > // > > I would like to send an mail via the mail function. // > > // > > If the mail failes I would like to redirect to an // errorpage. Currently // my // > > code looks like this: // > > // > > if ( mail($email,$subject_confirm_account, // $message_confirm_account, // > > $from_confirm_account) ){ // > > // HEADER("Location:index.php?fuseaction=txt&msg=registered"); //success // > > } // > > else{ // > > // HEADER("Location:index.php?fuseaction=txt&msg=mailproblem"); // mail // > > could not been sent // > > }; // > > // > > Unfortunatelly I get an erromessage like that: // > > // > > Warning: Failed to Connect in // > > // e:\projects\globosapiens\07_production\actual\account\include // \user.php // on // > > line 256 // > > // > > Warning: Cannot add header information - headers already // sent by (output // > > started at // > > // e:\projects\globosapiens\07_production\actual\account\include // \user.php:256) // > > in // e:\projects\globosapiens\07_production\actual\account\include // \user.php // > > on line 260 // > > // > > Where is the problem??? I can't see it. // > > // > > Maybe one of you guys could help me out. // > > // > > Thanx in advance, // > > // > > Luditus // // // // -- // PHP Database Mailing List (http://www.php.net/) // To unsubscribe, e-mail: [EMAIL PROTECTED] // For additional commands, e-mail: [EMAIL PROTECTED] // To contact the list administrators, e-mail: // [EMAIL PROTECTED] // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to write errorhandling??
Hello, > Warning: Cannot add header information - headers already sent by (output > started at > e:\projects\globosapiens\07_production\actual\account\include\user.php:256) > in e:\projects\globosapiens\07_production\actual\account\include\user.php > on line 260 > Where is the problem??? I can't see it. You don't have to send anything else than headers or data that uses header (cookies) before use any header functions. This error is probably due to an echo/print or you keep a space before "http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] How to write errorhandling??
If you use the at symbol to supress the error message from being printed, the if() statement will still recognize an error has occurred... So, try this: if (@mail($email,$subject_confirm_account, $message_confirm_account, $from_confirm_account)) { HEADER("Location:index.php?fuseaction=txt&msg=registered"); //success } else { HEADER("Location:index.php?fuseaction=txt&msg=mailproblem"); // mail could not been sent }; -Original Message- From: Luditus [mailto:[EMAIL PROTECTED]] Sent: Sunday, October 21, 2001 6:45 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] How to write errorhandling?? Hi Fokes, I would like to send an mail via the mail function. If the mail failes I would like to redirect to an errorpage. Currently my code looks like this: if ( mail($email,$subject_confirm_account, $message_confirm_account, $from_confirm_account) ){ HEADER("Location:index.php?fuseaction=txt&msg=registered"); //success } else{ HEADER("Location:index.php?fuseaction=txt&msg=mailproblem"); // mail could not been sent }; Unfortunatelly I get an erromessage like that: Warning: Failed to Connect in e:\projects\globosapiens\07_production\actual\account\include\user.php on line 256 Warning: Cannot add header information - headers already sent by (output started at e:\projects\globosapiens\07_production\actual\account\include\user.php:2 56) in e:\projects\globosapiens\07_production\actual\account\include\user.php on line 260 Where is the problem??? I can't see it. Maybe one of you guys could help me out. Thanx in advance, Luditus -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to write errorhandling??
"Attila Strauss" <[EMAIL PROTECTED]> wrote in message 01102113081306.00694@pluto">news:01102113081306.00694@pluto... > hi > > do an > > exit; > > after the header(); > > cu > attila > > > > On Sunday 21 October 2001 12:45, Luditus wrote: > > Hi Fokes, > > > > I would like to send an mail via the mail function. > > > > If the mail failes I would like to redirect to an errorpage. Currently my > > code looks like this: > > > > if ( mail($email,$subject_confirm_account, $message_confirm_account, > > $from_confirm_account) ){ > > HEADER("Location:index.php?fuseaction=txt&msg=registered"); //success > > } > > else{ > > HEADER("Location:index.php?fuseaction=txt&msg=mailproblem"); // mail > > could not been sent > > }; > > > > Unfortunatelly I get an erromessage like that: > > > > Warning: Failed to Connect in > > e:\projects\globosapiens\07_production\actual\account\include\user.php on > > line 256 > > > > Warning: Cannot add header information - headers already sent by (output > > started at > > e:\projects\globosapiens\07_production\actual\account\include\user.php:256) > > in e:\projects\globosapiens\07_production\actual\account\include\user.php > > on line 260 > > > > Where is the problem??? I can't see it. > > > > Maybe one of you guys could help me out. > > > > Thanx in advance, > > > > Luditus My experience is that ypu cannot use the header command if ypu type any text or something like that before the header.. i had to place the header on the top of the php page and if error goto header_func (of something like that).. i probably don't make sense.. to tired, =) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to write errorhandling??
Unfortunatelly this doesn't work at all. Same error. Any other ideas? Cheers Luditus "Attila Strauss" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 01102113081306.00694@pluto">news:01102113081306.00694@pluto... > hi > > do an > > exit; > > after the header(); > > cu > attila > > > > On Sunday 21 October 2001 12:45, Luditus wrote: > > Hi Fokes, > > > > I would like to send an mail via the mail function. > > > > If the mail failes I would like to redirect to an errorpage. Currently my > > code looks like this: > > > > if ( mail($email,$subject_confirm_account, $message_confirm_account, > > $from_confirm_account) ){ > > HEADER("Location:index.php?fuseaction=txt&msg=registered"); //success > > } > > else{ > > HEADER("Location:index.php?fuseaction=txt&msg=mailproblem"); // mail > > could not been sent > > }; > > > > Unfortunatelly I get an erromessage like that: > > > > Warning: Failed to Connect in > > e:\projects\globosapiens\07_production\actual\account\include\user.php on > > line 256 > > > > Warning: Cannot add header information - headers already sent by (output > > started at > > e:\projects\globosapiens\07_production\actual\account\include\user.php:256) > > in e:\projects\globosapiens\07_production\actual\account\include\user.php > > on line 260 > > > > Where is the problem??? I can't see it. > > > > Maybe one of you guys could help me out. > > > > Thanx in advance, > > > > Luditus -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to write errorhandling??
On Sunday 21 October 2001 06:45, Luditus wrote: > Hi Fokes, > > I would like to send an mail via the mail function. > > If the mail failes I would like to redirect to an errorpage. > Currently my code looks like this: > > if ( mail($email,$subject_confirm_account, > $message_confirm_account, $from_confirm_account) ){ > HEADER("Location:index.php?fuseaction=txt&msg=registered"); exit; > //success } > else{ > HEADER("Location:index.php?fuseaction=txt&msg=mailproblem"); exit; > // mail could not been sent > }; > > Unfortunatelly I get an erromessage like that: > > Warning: Failed to Connect in > e:\projects\globosapiens\07_production\actual\account\include\ >user.php on line 256 > > Warning: Cannot add header information - headers already sent > by (output started at > e:\projects\globosapiens\07_production\actual\account\include\ >user.php:256) in > e:\projects\globosapiens\07_production\actual\account\include\ >user.php on line 260 Try calling exit right after sending those Headers. Somehow the script is sending header information before your HEADER calls above. Do you have any output prior to that if block? Even an html dtd will do it. HTH, Jesse -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to write errorhandling??
hi do an exit; after the header(); cu attila On Sunday 21 October 2001 12:45, Luditus wrote: > Hi Fokes, > > I would like to send an mail via the mail function. > > If the mail failes I would like to redirect to an errorpage. Currently my > code looks like this: > > if ( mail($email,$subject_confirm_account, $message_confirm_account, > $from_confirm_account) ){ > HEADER("Location:index.php?fuseaction=txt&msg=registered"); //success > } > else{ > HEADER("Location:index.php?fuseaction=txt&msg=mailproblem"); // mail > could not been sent > }; > > Unfortunatelly I get an erromessage like that: > > Warning: Failed to Connect in > e:\projects\globosapiens\07_production\actual\account\include\user.php on > line 256 > > Warning: Cannot add header information - headers already sent by (output > started at > e:\projects\globosapiens\07_production\actual\account\include\user.php:256) > in e:\projects\globosapiens\07_production\actual\account\include\user.php > on line 260 > > Where is the problem??? I can't see it. > > Maybe one of you guys could help me out. > > Thanx in advance, > > Luditus -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]