Hello Tim, Saturday, October 20, 2007, 3:13:47 PM, you wrote:
> The "equivalent" you wrote should generally result in sending either > zero or two emails ... which is probably not what you want. > The code you're trying to grok is simply "send mail and if there's an > error, increment the error counter". A slightly more obvious way for > writing it would be: > $result = mail(...); > if (! $result){ > ++$err; > } > The way you re-wrote it, it says "send mail and if there's an error > increment the error counter. If there isn't an error, send the mail > a second time". > HTH > -Tim > On Oct 20, 2007, at 4:47 AM, [EMAIL PROTECTED] wrote: >> Greetings and Hello, >> >> I am converting a script to use SMTP if php mail() is not available >> for the users of this script. I have all the active calls working so >> that if my smtp flag is set it automatically switches to smtp and >> sends the message with the appropriate headers etc. but part of the >> script is run by a >> cron job and I see a php mail call but don't quite understand the >> syntax. >> Anyone care to take a guess at translating what it does? >> >> It is part of a while loop and I think its combining two conditions >> into one statement but would like confirmation. >> >> here is the code fragment: >> >> if ( !mail( $row['Email'], $row[Subj], $row[Body], "From: $site >> [email_notify]", "-f$site[email_notify]") ) >> ++$err; >> >> >> I thinks this is the equivalent of: >> >> if ( !mail( $row['Email'], $row[Subj], $row[Body], "From: $site >> [email_notify]", "-f$site[email_notify]") ) >> { >> ++$err; //update the error queue >> } >> else >> { >> mail( $row['Email'], $row[Subj], $row[Body], "From: $site >> [email_notify]", "-f$site[email_notify]"); >> } >> >> >> Has anyone seen or used this technique before? This is the first time >> I have seen it used, though this script has a lot of short cuts that >> make the code difficult to debug sometimes, like this one. >> >> Thanks in advance for your comments, >> -- >> Best regards, >> mikesz mailto:[EMAIL PROTECTED] >> >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > __________ NOD32 2604 (20071019) Information __________ > This message was checked by NOD32 antivirus system. > http://www.eset.com Thanks very much Tim, your example is exactly what I needed. -- Best regards, mikesz mailto:[EMAIL PROTECTED] _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php