[PHP] Parse Error in my Mail Function -UPDATED
Sorry I was too sleepy to realize the Red and BOLD wouldn't come through on the list. Here is the message again but I was smart enough this time to comment those section. All right I've used the help that I've gotten before about this and edited this function of code I have. Initially the code was meant to mail out a post to every email that was listed in the database. The problem was that it sent all the emails in the TO: section of the email. Now being that I didn't want to give out the emails of everyone on the list, I wanted to instead hardcode the TO: section and then drop all of the emails from the database into the BCC: section. The problem being now I am getting a parse error on lines 30. Included are the original code and my version(which is spitting the error). If anyone can offer any insight as to what I'm missing or messing up I should say it would be most appericated. ORIGINAL SECTION OF MAIL FUNCTION: function postNews () { // Get input from form, and members name. global $cookie_username, $headline, $post, $mail; // check to see if we should send email. if ($mail == yes) { global $setting_site_name, $setting_site_url, $setting_mail_email; $fhandle = fopen(newstemps/mailpost.tmp, r) or die(could not open newstemps/mailpost.tmp); $mailpost = fread($fhandle, filesize(newstemps/mailpost.tmp)); fclose ($fhandle); $mailpost = $mailpost; $mailpost = str_replace({setting_site_name}, $setting_site_name, $mailpost); $mailpost = str_replace({setting_site_url}, $setting_site_url, $mailpost); $mailpost = str_replace({setting_mail_email}, $setting_mail_email, $mailpost); $mailpost = str_replace({post_poster}, $cookie_username, $mailpost); $mailpost = str_replace({post_headline}, $headline, $mailpost); $mailpost = str_replace({post_date}, date(M d, Y, time()), $mailpost); $mailpost = str_replace({post_post}, $post, $mailpost); $to = ; $query = mysql_query(SELECT * FROM members); while ($member = mysql_fetch_array($query)) { if ($to == ) {$to = $member['email'];} else {$to .= , . $member['email'];} } $from = from: . $setting_mail_email; mail ($to, $setting_site_name, $mailpost, $from) or $emailsuccess = Failure sending email.; if ($emailsuccess == ) {$emailsuccess = Email Sent Successfully.;} } MY MODIFIED SECTION (I've commented the sections I changed and also the line with the parse error:) function postNews () { // Get input from form, and members name. global $cookie_username, $headline, $post, $mail; // check to see if we should send email. if ($mail == yes) { global $setting_site_name, $setting_site_url, $setting_mail_email; $fhandle = fopen(newstemps/mailpost.tmp, r) or die(could not open newstemps/mailpost.tmp); $mailpost = fread($fhandle, filesize(newstemps/mailpost.tmp)); fclose ($fhandle); $mailpost = $mailpost; $mailpost = str_replace({setting_site_name}, $setting_site_name, $mailpost); $mailpost = str_replace({setting_site_url}, $setting_site_url, $mailpost); $mailpost = str_replace({setting_mail_email}, $setting_mail_email, $mailpost); $mailpost = str_replace({post_poster}, $cookie_username, $mailpost); $mailpost = str_replace({post_headline}, $headline, $mailpost); $mailpost = str_replace({post_date}, date(M d, Y, time()), $mailpost); $mailpost = str_replace({post_post}, $post, $mailpost); //Everything Below here is where my changes occur $to = [EMAIL PROTECTED]; $from = from: . $setting_mail_email; $bcc = bcc: ; $query = mysql_query(SELECT * FROM members); while ($member = mysql_fetch_array($query)) { if ($bcc == ) {$bcc = $member['email'];} else {$bcc .= , . $member['email'];} } $headers = $from . \r\n . $bcc . \r\n //The Next Line is where I'm getting the parse Error at mail ($to, $setting_site_name, $mailpost, $headers) or $emailsuccess = Failure sending email.; if ($emailsuccess == ) {$emailsuccess = Email Sent Successfully.;} } Thanks for any insight that anyone might have.
Re: [PHP] Parse Error in my Mail Function -UPDATED
The problem being now I am getting a parse error on lines 30. Line 29, 30, and 31 is where exactly in all this?? Kind Regards, Chris Knipe MegaLAN Corporate Networking Services Tel: +27 21 854 7064 Cell: +27 72 434 7582 - Original Message - From: Anti-Blank [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 07, 2002 7:53 PM Subject: [PHP] Parse Error in my Mail Function -UPDATED Sorry I was too sleepy to realize the Red and BOLD wouldn't come through on the list. Here is the message again but I was smart enough this time to comment those section. All right I've used the help that I've gotten before about this and edited this function of code I have. Initially the code was meant to mail out a post to every email that was listed in the database. The problem was that it sent all the emails in the TO: section of the email. Now being that I didn't want to give out the emails of everyone on the list, I wanted to instead hardcode the TO: section and then drop all of the emails from the database into the BCC: section. The problem being now I am getting a parse error on lines 30. Included are the original code and my version(which is spitting the error). If anyone can offer any insight as to what I'm missing or messing up I should say it would be most appericated. ORIGINAL SECTION OF MAIL FUNCTION: function postNews () { // Get input from form, and members name. global $cookie_username, $headline, $post, $mail; // check to see if we should send email. if ($mail == yes) { global $setting_site_name, $setting_site_url, $setting_mail_email; $fhandle = fopen(newstemps/mailpost.tmp, r) or die(could not open newstemps/mailpost.tmp); $mailpost = fread($fhandle, filesize(newstemps/mailpost.tmp)); fclose ($fhandle); $mailpost = $mailpost; $mailpost = str_replace({setting_site_name}, $setting_site_name, $mailpost); $mailpost = str_replace({setting_site_url}, $setting_site_url, $mailpost); $mailpost = str_replace({setting_mail_email}, $setting_mail_email, $mailpost); $mailpost = str_replace({post_poster}, $cookie_username, $mailpost); $mailpost = str_replace({post_headline}, $headline, $mailpost); $mailpost = str_replace({post_date}, date(M d, Y, time()), $mailpost); $mailpost = str_replace({post_post}, $post, $mailpost); $to = ; $query = mysql_query(SELECT * FROM members); while ($member = mysql_fetch_array($query)) { if ($to == ) {$to = $member['email'];} else {$to .= , . $member['email'];} } $from = from: . $setting_mail_email; mail ($to, $setting_site_name, $mailpost, $from) or $emailsuccess = Failure sending email.; if ($emailsuccess == ) {$emailsuccess = Email Sent Successfully.;} } MY MODIFIED SECTION (I've commented the sections I changed and also the line with the parse error:) function postNews () { // Get input from form, and members name. global $cookie_username, $headline, $post, $mail; // check to see if we should send email. if ($mail == yes) { global $setting_site_name, $setting_site_url, $setting_mail_email; $fhandle = fopen(newstemps/mailpost.tmp, r) or die(could not open newstemps/mailpost.tmp); $mailpost = fread($fhandle, filesize(newstemps/mailpost.tmp)); fclose ($fhandle); $mailpost = $mailpost; $mailpost = str_replace({setting_site_name}, $setting_site_name, $mailpost); $mailpost = str_replace({setting_site_url}, $setting_site_url, $mailpost); $mailpost = str_replace({setting_mail_email}, $setting_mail_email, $mailpost); $mailpost = str_replace({post_poster}, $cookie_username, $mailpost); $mailpost = str_replace({post_headline}, $headline, $mailpost); $mailpost = str_replace({post_date}, date(M d, Y, time()), $mailpost); $mailpost = str_replace({post_post}, $post, $mailpost); //Everything Below here is where my changes occur $to = [EMAIL PROTECTED]; $from = from: . $setting_mail_email; $bcc = bcc: ; $query = mysql_query(SELECT * FROM members); while ($member = mysql_fetch_array($query)) { if ($bcc == ) {$bcc = $member['email'];} else {$bcc .= , . $member['email'];} } $headers = $from . \r\n . $bcc . \r\n //The Next Line is where I'm getting the parse Error at mail ($to, $setting_site_name, $mailpost, $headers) or $emailsuccess = Failure sending email.; if ($emailsuccess == ) {$emailsuccess = Email Sent Successfully.;} } Thanks for any insight that anyone might have. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error in my Mail Function -UPDATED
Lines 29, 30, and 31 //29 $headers = $from . \r\n . $bcc . \r\n //30 - The Next Line is where I'm getting the parse Error at: mail ($to, $setting_site_name, $mailpost, $headers) or $emailsuccess =Failure sending email.; //31 if ($emailsuccess == ) {$emailsuccess = Email Sent Successfully.;} - Original Message - From: Chris Knipe [EMAIL PROTECTED] To: Anti-Blank [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, June 07, 2002 12:40 PM Subject: Re: [PHP] Parse Error in my Mail Function -UPDATED The problem being now I am getting a parse error on lines 30. Line 29, 30, and 31 is where exactly in all this?? Kind Regards, Chris Knipe MegaLAN Corporate Networking Services Tel: +27 21 854 7064 Cell: +27 72 434 7582 - Original Message - From: Anti-Blank [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 07, 2002 7:53 PM Subject: [PHP] Parse Error in my Mail Function -UPDATED Sorry I was too sleepy to realize the Red and BOLD wouldn't come through on the list. Here is the message again but I was smart enough this time to comment those section. All right I've used the help that I've gotten before about this and edited this function of code I have. Initially the code was meant to mail out a post to every email that was listed in the database. The problem was that it sent all the emails in the TO: section of the email. Now being that I didn't want to give out the emails of everyone on the list, I wanted to instead hardcode the TO: section and then drop all of the emails from the database into the BCC: section. The problem being now I am getting a parse error on lines 30. Included are the original code and my version(which is spitting the error). If anyone can offer any insight as to what I'm missing or messing up I should say it would be most appericated. ORIGINAL SECTION OF MAIL FUNCTION: function postNews () { // Get input from form, and members name. global $cookie_username, $headline, $post, $mail; // check to see if we should send email. if ($mail == yes) { global $setting_site_name, $setting_site_url, $setting_mail_email; $fhandle = fopen(newstemps/mailpost.tmp, r) or die(could not open newstemps/mailpost.tmp); $mailpost = fread($fhandle, filesize(newstemps/mailpost.tmp)); fclose ($fhandle); $mailpost = $mailpost; $mailpost = str_replace({setting_site_name}, $setting_site_name, $mailpost); $mailpost = str_replace({setting_site_url}, $setting_site_url, $mailpost); $mailpost = str_replace({setting_mail_email}, $setting_mail_email, $mailpost); $mailpost = str_replace({post_poster}, $cookie_username, $mailpost); $mailpost = str_replace({post_headline}, $headline, $mailpost); $mailpost = str_replace({post_date}, date(M d, Y, time()), $mailpost); $mailpost = str_replace({post_post}, $post, $mailpost); $to = ; $query = mysql_query(SELECT * FROM members); while ($member = mysql_fetch_array($query)) { if ($to == ) {$to = $member['email'];} else {$to .= , . $member['email'];} } $from = from: . $setting_mail_email; mail ($to, $setting_site_name, $mailpost, $from) or $emailsuccess = Failure sending email.; if ($emailsuccess == ) {$emailsuccess = Email Sent Successfully.;} } MY MODIFIED SECTION (I've commented the sections I changed and also the line with the parse error:) function postNews () { // Get input from form, and members name. global $cookie_username, $headline, $post, $mail; // check to see if we should send email. if ($mail == yes) { global $setting_site_name, $setting_site_url, $setting_mail_email; $fhandle = fopen(newstemps/mailpost.tmp, r) or die(could not open newstemps/mailpost.tmp); $mailpost = fread($fhandle, filesize(newstemps/mailpost.tmp)); fclose ($fhandle); $mailpost = $mailpost; $mailpost = str_replace({setting_site_name}, $setting_site_name, $mailpost); $mailpost = str_replace({setting_site_url}, $setting_site_url, $mailpost); $mailpost = str_replace({setting_mail_email}, $setting_mail_email, $mailpost); $mailpost = str_replace({post_poster}, $cookie_username, $mailpost); $mailpost = str_replace({post_headline}, $headline, $mailpost); $mailpost = str_replace({post_date}, date(M d, Y, time()), $mailpost); $mailpost = str_replace({post_post}, $post, $mailpost); //Everything Below here is where my changes occur $to = [EMAIL PROTECTED]; $from = from: . $setting_mail_email; $bcc = bcc: ; $query = mysql_query(SELECT * FROM members); while ($member = mysql_fetch_array($query)) { if ($bcc == ) {$bcc = $member['email'];} else {$bcc .= , . $member['email'];} } $headers = $from . \r\n . $bcc . \r\n //The Next Line is where I'm getting the parse Error at mail ($to, $setting_site_name, $mailpost, $headers) or $emailsuccess = Failure sending email.; if ($emailsuccess == ) {$emailsuccess = Email Sent Successfully.;} } Thanks for any insight that anyone might have. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http
Re[2]: [PHP] Parse Error in my Mail Function -UPDATED
On Friday, June 7, 2002 at 7:08:00 PM, you wrote: Lines 29, 30, and 31 //29 $headers = $from . \r\n . $bcc . \r\n //30 - The Next Line is where I'm getting the parse Error at: mail ($to, $setting_site_name, $mailpost, $headers) or $emailsuccess =Failure sending email.; //31 if ($emailsuccess == ) {$emailsuccess = Email Sent Successfully.;} Line 29 is missing a semicolon at the end. It would have been much simpler if you had just posted these 3 lines in the first place. -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php