intermitent php mail message error

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
malliaris
Registered User
Posts: 9
Joined: Tue Mar 26, 2002 6:11 pm
Location: London, UK
Contact:

intermitent php mail message error

Post by malliaris » Sun Nov 09, 2008 8:14 pm

greetings to all,

I am having some intermittend error messages when sending new posts or even pm. I get the usual php mail error discussed in other forums but the only difference is that my mailer works fine. Both the messages are posted fine and also the pm are delivered ok.

Any ideas what may be causing this and how I can stop this?

The problem is that this is intermittent and it wasn't happening before. The only thing that I can think of is installing a few recent mods - especially the one that notifies the admin for all new messages and posts (not pms though).

grateful for your assistance.

thanks

yanni

User avatar
ric323
Former Team Member
Posts: 22909
Joined: Tue Feb 06, 2007 12:33 am
Location: Melbourne, Australia
Name: Ric
Contact:

Re: intermitent php mail message error

Post by ric323 » Sun Nov 09, 2008 9:45 pm

A peek at what the error message actually says could be helpful!
The Knowledge Base contains solutions to many common problems!
How to fix "Doesn't have a default value" and "Incorrect string value: xxx for column 'post_text' " errors.
How to do a clean re-install of the latest phpBB3 version.
Problems with permissions? Read phpBB3 Permissions

malliaris
Registered User
Posts: 9
Joined: Tue Mar 26, 2002 6:11 pm
Location: London, UK
Contact:

Re: intermitent php mail message error

Post by malliaris » Sun Nov 09, 2008 10:03 pm

thanx...when it comes on after posting messages it gives the know 234 error (but the php mailer works after i did a test). I deactivated the debug system with the hope that the error will go away...

with the PM error it gave some genenal php mail error...I saw only once (i am sorry) so I didn't take any notes down. I will post them in verbatim next time I see them...

the weird thing is that they are intermittent and the messages get send anyway.

suffice it to say my 1and1 smtp function is not working and they tell me that with phpbb2 only php mail works with their servers.

Yanni

espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Re: intermitent php mail message error

Post by espicom » Tue Nov 11, 2008 5:30 am

Intermittent problems are almost certainly at the mail server end; I deal with quite a number of applications that do emailing from websites, and the errors from the mailing side are generally for bad addresses, but the mail server side can do things like toss up an intermittent DNS issue, or trip a spam filter, or who knows what (without looking at the server's logs).

My mail servers send me a message each and every time they bounce a message, no matter what the cause, including the other end just breaking the connection. It's thousands of messages per day to weed through, but it makes finding those "intermittent" problems that are actually colourful ways of spelling "verizon" or "sbcglobal" MUCH simpler!
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer

malliaris
Registered User
Posts: 9
Joined: Tue Mar 26, 2002 6:11 pm
Location: London, UK
Contact:

Re: intermitent php mail message error

Post by malliaris » Sat Nov 15, 2008 1:44 am

are they due to the server?

I am not sure anymore in my case. I basically started having these intermittent problems since I installed a script that would notify my moderators of new posts.

I just picked one of the error messages:

Fatal error: Cannot redeclare class emailer in /homepages/41/d175400140/htdocs/edo2/forum/includes/emailer.php on line 28

I could of course uninstall the script but I need to have a way to notify my moderators of all new posts. We run a rather sensitive patient forum in greek for a non-profit and it is important that they read all messages as they come online.

grateful for any assistance.

Our forum is EDO: www.bipolar.gr/forum

Most of it is in Greek - but just in case you need to see anything.

thanks

Yanni

espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Re: intermitent php mail message error

Post by espicom » Sun Nov 16, 2008 1:39 am

Your script is trying to include a class definition, after it has already done so. Does it explicitly include email.php? If so, it shouldn't - that's included by the common.php script, and the second time is what is causing the error.
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer

malliaris
Registered User
Posts: 9
Joined: Tue Mar 26, 2002 6:11 pm
Location: London, UK
Contact:

Re: intermitent php mail message error

Post by malliaris » Sun Nov 16, 2008 1:50 am

many thanks. I've been waiting for some reply quite anxiously. So what do I do? And if there is something wrong with the script code why isn't the problem consistent?

Where would I need to go to change the code? Which script would that be?

thanks for your input again.

Yanni

malliaris
Registered User
Posts: 9
Joined: Tue Mar 26, 2002 6:11 pm
Location: London, UK
Contact:

Re: intermitent php mail message error

Post by malliaris » Sun Nov 16, 2008 2:42 am

I found the script I think I used to notify me of new messages. It was the simplest one. Not still sure if that's the one causing the problem but before we were ok really.

I think I followed all the instructions to the letter and installed and modified everything according to this. I attach the script files as well. I think there is something going on in the notify_admin.php file that messes things up. There is code in there about the emailer but I am not a programmer and can't make much sense out of it.

thanks

Yanni

ps. it didn't let me attach the files...I include them here if that's ok.

notify_admin.php file

Code: Select all

<?php
/***************************************************************************
 *                            notify_admin.php
 *                            -------------------
 *   begin                : Thursday, Nov 15, 2007
 *   copyright            : (C) 2007 MSSTI
 *   email                : info@mssti.com
 *   support              : http://www.mssti.com/phpbb2
 *
 *   $Id: notify_admin.php,v 1.0.0 2007/11/15 03:10:55 leviatan21 Exp $
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

if (!defined('IN_PHPBB'))
{
	die('Hacking attempt');
}

// --------------------------------------------------
// Some configuration options!
// --------------------------------------------------

$board_config['notify_newtopic'] = true;		// Sendme e-mail notification on "New Topics" : true/false
$board_config['notify_newtopic_text'] = true;	// Do you want include the "New Topic" text in the e-mail : true/false

$board_config['notify_editpost'] = true;		// Sendme e-mail notification on "Edited Post/Topics" : true/false
$board_config['notify_editpost_text'] = true;	// Do you want include the "Edited Post/Topic" text in the e-mail : true/false

$board_config['notify_reply'] = true;			// Sendme e-mail notification on "Replys Post/Topics" : true/false
$board_config['notify_reply_text'] = true;		// Do you want include the "Reply Post/Topic" text in the e-mail : true/false

// --------------------------------------------------
// You don't need to edit anything below this line!!!
// --------------------------------------------------

if ($board_config['notify_newtopic'] || $board_config['notify_reply'] || $board_config['notify_editpost']) 
{
	if (!class_exists('emailer'))
	{
		include($phpbb_root_path . 'includes/emailer.' . $phpEx);
	}
	$emailer = new emailer($board_config['smtp_delivery']);

	$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
	$script_name = ($script_name != '') ? $script_name . '/viewtopic.' . $phpEx : 'viewtopic.' . $phpEx;
	$server_name = trim($board_config['server_name']);
	$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://' ;
	$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) . '/' : '/';

	$emailer->from($board_config['board_email']);
	$emailer->replyto($board_config['board_email']);
	$emailer->email_address($board_config['board_email']);

	$emailer->use_template('notify_admin', $user_lang);

	if ($mode == 'newtopic' && $board_config['notify_newtopic'] )
	{
		$email_subject = $lang['Topic_New_Notify'] . $post_subject;
		$email_subject_explain = $lang['Topic_New_Notify_explain'];
		$email_link = '';
	}
	else if ($mode == 'editpost' && $board_config['notify_editpost'] )
	{
		$email_subject = $lang['Topic_Edit_Notify'] . $post_subject;
		$email_subject_explain = $lang['Topic_Edit_Notify_explain'];
		$email_link = '#' . $post_id;
	}
	else if ($mode == 'reply' && $board_config['notify_reply'])
	{
		$email_subject = $lang['Topic_Reply_Notify'] . $post_subject;
		$email_subject_explain = $lang['Topic_Reply_Notify_explain'];
		$email_link = '#' . $post_id;
	}
	
	if ( $board_config['notify_newtopic_text'] || $board_config['notify_editpost_text'] || $board_config['notify_reply_text'])
	{
		$l_text_post = $lang['Message_body'] . ' : ';

		$unhtml_specialchars_match   = array('\"', "&#58;", '&', '<', '>', "&#40;", "&#41;", "&#91;", "&#93;", "&#123;", "&#125;");
		$unhtml_specialchars_replace = array('"'      , ':'    , '&'    , '<'   , '>'   , '('    , ')'    , '['    , ']'    , '{'     , '}'     );

		$post_message = preg_replace("#\[(.*?)\]#si", "", $post_message);
		$post_message =  str_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, $post_message);

		$email_text_post = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" . $post_message . "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
	}

	@reset($bcc_list_ary);

	$emailer->set_subject($email_subject); 
	$emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg);
	$emailer->assign_vars(array(
		'EMAIL_SUBJECT' => $email_subject,
		'POST_TITLE' => $post_subject,
		'POST_USERNAME' => '" '. $userdata['username'] . ' "',
		'L_EMAIL_SUBJECT' => $email_subject_explain,
		'SITENAME' => $board_config['sitename'],
		'L_TEXT_POST' => $l_text_post,
		'TEXT_POST' => $email_text_post,
		'U_POST' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . "=" . $post_id . $email_link ,
		'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
	));
	$emailer->send();
	$emailer->reset();
}

?>

espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Re: intermitent php mail message error

Post by espicom » Sun Nov 16, 2008 8:10 pm

Try changing:

Code: Select all

   if (!class_exists('emailer'))
   {
      include($phpbb_root_path . 'includes/emailer.' . $phpEx);
   }
to:

Code: Select all

//   if (!class_exists('emailer'))
//   {
//      include($phpbb_root_path . 'includes/emailer.' . $phpEx);
//   }
and see if the errors disappear. If this script is being included by another (like posting.php), the emailer class should already be defined, and ready to use, so the include is redundant.

Also, an alternate solution - installation of "forum notification", such as the one over on phpbbhacks.com, and having the moderators subscribe to the forums they're monitoring. The one I use sends the text of the message with the notification, and also sends every message in a subscribed forum, not just the first in a topic since you last visited...
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer

malliaris
Registered User
Posts: 9
Joined: Tue Mar 26, 2002 6:11 pm
Location: London, UK
Contact:

Re: intermitent php mail message error

Post by malliaris » Sun Nov 16, 2008 8:51 pm

Jeff many thanks for your input.

I found the authors website forum and had a few
Comms with him. He found his error but the solution he provided
Didn't work at all. It broke my entire post function.

I will send an email with this chat later.

I will follow your advise and go with the other script. It sounds more suitable
To our needs anyway. I will get back again with a link from his forum.

He has produced a nice little script but a bit careless in its
Implementation I guess.

Anyway, this is my first post from the browser of my blackberry bold! It almost works :)

Yanni

malliaris
Registered User
Posts: 9
Joined: Tue Mar 26, 2002 6:11 pm
Location: London, UK
Contact:

Re: intermitent php mail message error

Post by malliaris » Sun Nov 16, 2008 10:40 pm

Jeff,

do you mind providing a link to that forum notification mod?

I can't seem to find it in phpbbhacks.com

I deleted the other script entirely, hopefully the problems will go away. Mind you I am running phpbb 2.0.21 using greek as my main language and the xand theme.

I am also thinking of saying goodbye soon enough to 1and.co.uk and moving to mediatemple - hoping for a virtual private server...seems ideal and I like their entire presentation.

thanks

Yanni

ps. here is my communication with the author of the other script: http://www.mssti.com/phpbb2/viewtopic.php?t=101

what he suggested didn't work really...

User avatar
ric323
Former Team Member
Posts: 22909
Joined: Tue Feb 06, 2007 12:33 am
Location: Melbourne, Australia
Name: Ric
Contact:

Re: intermitent php mail message error

Post by ric323 » Sun Nov 16, 2008 11:07 pm

What he suggested looks fine. I also suspect you made a mistake installing that change.
The Knowledge Base contains solutions to many common problems!
How to fix "Doesn't have a default value" and "Incorrect string value: xxx for column 'post_text' " errors.
How to do a clean re-install of the latest phpBB3 version.
Problems with permissions? Read phpBB3 Permissions

malliaris
Registered User
Posts: 9
Joined: Tue Mar 26, 2002 6:11 pm
Location: London, UK
Contact:

Re: intermitent php mail message error

Post by malliaris » Sun Nov 16, 2008 11:13 pm

maybe. i followed his instructions to the letter. copied and pasted the change but the uploaded file would break my post function completely. I may not be a professional programmer but I have gained some experience following the mod instructions to the letter and updating things as I am being instructed. I cannot comment of course on the content of his code only on what I experienced.

espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Re: intermitent php mail message error

Post by espicom » Tue Nov 18, 2008 2:33 am

I think the forum notification MOD I use is here: http://www.phpbbhacks.com/download/293
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer

Locked

Return to “2.0.x Support Forum”