[問題]請問關於Yellow card 1.4.11

phpBB 2 MOD Support
無論是官方或非官方認證之外掛,安裝與使用問題討論。
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

主題已鎖定
arti
星球公民
星球公民
文章: 52
註冊時間: 2003-09-28 09:00

[問題]請問關於Yellow card 1.4.11

文章 arti »

外掛相關連結http://mods.db9.dk/viewtopic.php?t=8
不好意思這黃卡又發現新問題,
再問一次。
我在使用黃卡外掛中的藍卡會出現如下面的錯誤。
圖檔
圖檔

原本修改說明如下。
#-----[ OPEN ]------------------------------------------------
#
includes/smtp.php

#
#-----[ FIND ]------------------------------------------------
#
// Send the Subject Line...
fputs($socket, "Subject: $subject
");

// Now the To Header.
fputs($socket, "To: $mail_to
");

#
#-----[ REPLACE WITH ]----------------------------------------
#

// Send the Subject Line...
if (!eregi ('Subject:',$subject)) fputs($socket, "Subject: $subject
");

// Now the To Header.
if (!eregi ('To:',$headers)) fputs($socket, "To: $mail_to
");

#
請問smtp.php這檔應該如何修正呢?

代碼: 選擇全部

[php]<?php
/***************************************************************************
 *                              smtp.php
 *                       -------------------
 *   begin                : Wed May 09 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: smtp.php,v 1.16.2.9 2003/07/18 16:34:01 acydburn 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.
 *
 ***************************************************************************/

define('SMTP_INCLUDED', 1);

//
// This function has been modified as provided
// by SirSir to allow multiline responses when 
// using SMTP Extensions
//
function server_parse($socket, $response, $line = __LINE__) 
{ 
	while (substr($server_response, 3, 1) != ' ') 
	{
		if (!($server_response = fgets($socket, 256))) 
		{ 
			message_die(GENERAL_ERROR, "Couldn't get mail server response codes", "", $line, __FILE__); 
		} 
	} 

	if (!(substr($server_response, 0, 3) == $response)) 
	{ 
		message_die(GENERAL_ERROR, "Ran into problems sending Mail. Response: $server_response", "", $line, __FILE__); 
	} 
}

// Replacement or substitute for PHP's mail command
function smtpmail($mail_to, $subject, $message, $headers = '')
{
	global $board_config;

	// Fix any bare linefeeds in the message to make it RFC821 Compliant.
	$message = preg_replace("#(?<!
)
#si", "
", $message);

	if ($headers != '')
	{
		if (is_array($headers))
		{
			if (sizeof($headers) > 1)
			{
				$headers = join("
", $headers);
			}
			else
			{
				$headers = $headers[0];
			}
		}
		$headers = chop($headers);

		// Make sure there are no bare linefeeds in the headers
		$headers = preg_replace('#(?<!
)
#si', "
", $headers);

		// Ok this is rather confusing all things considered,
		// but we have to grab bcc and cc headers and treat them differently
		// Something we really didn't take into consideration originally
		$header_array = explode("
", $headers);
		@reset($header_array);

		$headers = '';
		while(list(, $header) = each($header_array))
		{
			if (preg_match('#^cc:#si', $header))
			{
				$cc = preg_replace('#^cc:(.*)#si', '\1', $header);
			}
			else if (preg_match('#^bcc:#si', $header))
			{
				$bcc = preg_replace('#^bcc:(.*)#si', '\1', $header);
				$header = '';
			}
			$headers .= ($header != '') ? $header . "
" : '';
		}

		$headers = chop($headers);
		$cc = explode(', ', $cc);
		$bcc = explode(', ', $bcc);
	}

	if (trim($subject) == '')
	{
		message_die(GENERAL_ERROR, "No email Subject specified", "", __LINE__, __FILE__);
	}

	if (trim($message) == '')
	{
		message_die(GENERAL_ERROR, "Email message was blank", "", __LINE__, __FILE__);
	}

	// Ok we have error checked as much as we can to this point let's get on
	// it already.
	if( !$socket = fsockopen($board_config['smtp_host'], 25, $errno, $errstr, 20) )
	{
		message_die(GENERAL_ERROR, "Could not connect to smtp host : $errno : $errstr", "", __LINE__, __FILE__);
	}

	// Wait for reply
	server_parse($socket, "220", __LINE__);

	// Do we want to use AUTH?, send RFC2554 EHLO, else send RFC821 HELO
	// This improved as provided by SirSir to accomodate
	if( !empty($board_config['smtp_username']) && !empty($board_config['smtp_password']) )
	{ 
		fputs($socket, "EHLO " . $board_config['smtp_host'] . "
");
		server_parse($socket, "250", __LINE__);

		fputs($socket, "AUTH LOGIN
");
		server_parse($socket, "334", __LINE__);

		fputs($socket, base64_encode($board_config['smtp_username']) . "
");
		server_parse($socket, "334", __LINE__);

		fputs($socket, base64_encode($board_config['smtp_password']) . "
");
		server_parse($socket, "235", __LINE__);
	}
	else
	{
		fputs($socket, "HELO " . $board_config['smtp_host'] . "
");
		server_parse($socket, "250", __LINE__);
	}

	// From this point onward most server response codes should be 250
	// Specify who the mail is from....
	fputs($socket, "MAIL FROM: <" . $board_config['board_email'] . ">
");
	server_parse($socket, "250", __LINE__);

	// Specify each user to send to and build to header.
	$to_header = '';

	// Add an additional bit of error checking to the To field.
	$mail_to = (trim($mail_to) == '') ? 'Undisclosed-recipients:;' : trim($mail_to);
	if (preg_match('#[^ ]+\@[^ ]+#', $mail_to))
	{
		fputs($socket, "RCPT TO: <$mail_to>
");
		server_parse($socket, "250", __LINE__);
	}

	// Ok now do the CC and BCC fields...
	@reset($bcc);
	while(list(, $bcc_address) = each($bcc))
	{
		// Add an additional bit of error checking to bcc header...
		$bcc_address = trim($bcc_address);
		if (preg_match('#[^ ]+\@[^ ]+#', $bcc_address))
		{
			fputs($socket, "RCPT TO: <$bcc_address>
");
			server_parse($socket, "250", __LINE__);
		}
	}

	@reset($cc);
	while(list(, $cc_address) = each($cc))
	{
		// Add an additional bit of error checking to cc header
		$cc_address = trim($cc_address);
		if (preg_match('#[^ ]+\@[^ ]+#', $cc_address))
		{
			fputs($socket, "RCPT TO: <$cc_address>
");
			server_parse($socket, "250", __LINE__);
		}
	}

	// Ok now we tell the server we are ready to start sending data
	fputs($socket, "DATA
");

	// This is the last response code we look for until the end of the message.
	server_parse($socket, "354", __LINE__);

	// Send the Subject Line...
	if (!eregi ('Subject:',$subject)) fputs($socket, "Subject: $subject
");

	// Now the To Header.
	if (!eregi ('To:',$mail_to)) fputs($socket, "To: $mail_to
");

	// Now any custom headers....
	fputs($socket, "$headers

");

	// Ok now we are ready for the message...
	fputs($socket, "$message
");

	// Ok the all the ingredients are mixed in let's cook this puppy...
	fputs($socket, ".
");
	server_parse($socket, "250", __LINE__);

	// Now tell the server we are done and close the socket...
	fputs($socket, "QUIT
");
	fclose($socket);

	return TRUE;
}

?>[/php]
。。鳳凰寺 風。。
星球公民
星球公民
文章: 91
註冊時間: 2004-09-17 04:48
聯繫:

文章 。。鳳凰寺 風。。 »

的stmp.php是沒修改的嗎?
如果是的話 試試看把你stmp.php這段\r

代碼: 選擇全部

 // Send the Subject Line... 
   if (!eregi ('Subject:',$subject)) fputs($socket, "Subject: $subjectrn" 

   // Now the To Header. 
   if (!eregi ('To:',$mail_to)) fputs($socket, "To: $mail_torn"
取代成這段 試試看

代碼: 選擇全部

// Send the Subject Line... 
if (!eregi ('Subject:',$subject)) fputs($socket, "Subject: $subject
"); 

// Now the To Header. 
if (!eregi ('To:',$headers)) fputs($socket, "To: $mail_to
");
如果還不行的話 可能就要請其他版大幫你囉
因為我自己也沒碰過黃卡系統~~~
如果驕傲沒被現實大海冷冷拍響,又怎會懂得要多努力才走得到遠方;
如果夢想不曾墜落懸崖千均一髮,又怎會曉得執著的人擁有隱形翅膀。
arti
星球公民
星球公民
文章: 52
註冊時間: 2003-09-28 09:00

文章 arti »

有改依然無效,
忘了說我的論壇程式是2.0.10版,
請問是否後台還是哪要做設定?

我也嘗試參考伊夢兒大大的,
[修正]黃卡系統修正電子郵件檔頭=http://phpbb-tw.net/phpbb/viewtopic.php ... %B6%C0%A5d
不管改不改都無法解決這問題。
。。鳳凰寺 風。。
星球公民
星球公民
文章: 91
註冊時間: 2004-09-17 04:48
聯繫:

文章 。。鳳凰寺 風。。 »

呃~
你後台-->基本組態-->電子郵件設定,有設定嗎?
如果沒有的話,請參考這篇http://phpbb-tw.net/phpbb/viewtopic.php?t=26589
設定好的話,你在試試看~~
如果驕傲沒被現實大海冷冷拍響,又怎會懂得要多努力才走得到遠方;
如果夢想不曾墜落懸崖千均一髮,又怎會曉得執著的人擁有隱形翅膀。
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8547
註冊時間: 2004-04-30 01:54
來自: Taiwan

Re: [問題]請問關於Yellow card 1.4.11

文章 心靈捕手 »

arti 寫:請問smtp.php這檔應該如何修正呢?

代碼: 選擇全部

[php]<?php
/***************************************************************************
 *                              smtp.php
 *                       -------------------
 *   begin                : Wed May 09 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: smtp.php,v 1.16.2.9 2003/07/18 16:34:01 acydburn 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.
 *
 ***************************************************************************/

define('SMTP_INCLUDED', 1);

//
// This function has been modified as provided
// by SirSir to allow multiline responses when 
// using SMTP Extensions
//
function server_parse($socket, $response, $line = __LINE__) 
{ 
	while (substr($server_response, 3, 1) != ' ') 
	{
		if (!($server_response = fgets($socket, 256))) 
		{ 
			message_die(GENERAL_ERROR, "Couldn't get mail server response codes", "", $line, __FILE__); 
		} 
	} 

	if (!(substr($server_response, 0, 3) == $response)) 
	{ 
		message_die(GENERAL_ERROR, "Ran into problems sending Mail. Response: $server_response", "", $line, __FILE__); 
	} 
}

// Replacement or substitute for PHP's mail command
function smtpmail($mail_to, $subject, $message, $headers = '')
{
	global $board_config;

	// Fix any bare linefeeds in the message to make it RFC821 Compliant.
	$message = preg_replace("#(?<!
)
#si", "
", $message);

	if ($headers != '')
	{
		if (is_array($headers))
		{
			if (sizeof($headers) > 1)
			{
				$headers = join("
", $headers);
			}
			else
			{
				$headers = $headers[0];
			}
		}
		$headers = chop($headers);

		// Make sure there are no bare linefeeds in the headers
		$headers = preg_replace('#(?<!
)
#si', "
", $headers);

		// Ok this is rather confusing all things considered,
		// but we have to grab bcc and cc headers and treat them differently
		// Something we really didn't take into consideration originally
		$header_array = explode("\
", $headers);
		@reset($header_array);

		$headers = '';
		while(list(, $header) = each($header_array))
		{
			if (preg_match('#^cc:#si', $header))
			{
				$cc = preg_replace('#^cc:(.*)#si', '\1', $header);
			}
			else if (preg_match('#^bcc:#si', $header))
			{
				$bcc = preg_replace('#^bcc:(.*)#si', '\1', $header);
				$header = '';
			}
			$headers .= ($header != '') ? $header . "
" : '';
		}

		$headers = chop($headers);
		$cc = explode(', ', $cc);
		$bcc = explode(', ', $bcc);
	}

	if (trim($subject) == '')
	{
		message_die(GENERAL_ERROR, "No email Subject specified", "", __LINE__, __FILE__);
	}

	if (trim($message) == '')
	{
		message_die(GENERAL_ERROR, "Email message was blank", "", __LINE__, __FILE__);
	}

	// Ok we have error checked as much as we can to this point let's get on
	// it already.
	if( !$socket = fsockopen($board_config['smtp_host'], 25, $errno, $errstr, 20) )
	{
		message_die(GENERAL_ERROR, "Could not connect to smtp host : $errno : $errstr", "", __LINE__, __FILE__);
	}

	// Wait for reply
	server_parse($socket, "220", __LINE__);

	// Do we want to use AUTH?, send RFC2554 EHLO, else send RFC821 HELO
	// This improved as provided by SirSir to accomodate
	if( !empty($board_config['smtp_username']) && !empty($board_config['smtp_password']) )
	{ 
		fputs($socket, "EHLO " . $board_config['smtp_host'] . "
");
		server_parse($socket, "250", __LINE__);

		fputs($socket, "AUTH LOGIN
");
		server_parse($socket, "334", __LINE__);

		fputs($socket, base64_encode($board_config['smtp_username']) . "
");
		server_parse($socket, "334", __LINE__);

		fputs($socket, base64_encode($board_config['smtp_password']) . "
\
");
		server_parse($socket, "235", __LINE__);
	}
	else
	{
		fputs($socket, "HELO " . $board_config['smtp_host'] . "
");
		server_parse($socket, "250", __LINE__);
	}

	// From this point onward most server response codes should be 250
	// Specify who the mail is from....
	fputs($socket, "MAIL FROM: <" . $board_config['board_email'] . ">
");
	server_parse($socket, "250", __LINE__);

	// Specify each user to send to and build to header.
	$to_header = '';

	// Add an additional bit of error checking to the To field.
	$mail_to = (trim($mail_to) == '') ? 'Undisclosed-recipients:;' : trim($mail_to);
	if (preg_match('#[^ ]+\@[^ ]+#', $mail_to))
	{
		fputs($socket, "RCPT TO: <$mail_to>
");
		server_parse($socket, "250", __LINE__);
	}

	// Ok now do the CC and BCC fields...
	@reset($bcc);
	while(list(, $bcc_address) = each($bcc))
	{
		// Add an additional bit of error checking to bcc header...
		$bcc_address = trim($bcc_address);
		if (preg_match('#[^ ]+\@[^ ]+#', $bcc_address))
		{
			fputs($socket, "RCPT TO: <$bcc_address>
");
			server_parse($socket, "250", __LINE__);
		}
	}

	@reset($cc);
	while(list(, $cc_address) = each($cc))
	{
		// Add an additional bit of error checking to cc header
		$cc_address = trim($cc_address);
		if (preg_match('#[^ ]+\@[^ ]+#', $cc_address))
		{
			fputs($socket, "RCPT TO: <$cc_address>
");
			server_parse($socket, "250", __LINE__);
		}
	}

	// Ok now we tell the server we are ready to start sending data
	fputs($socket, "DATA
");

	// This is the last response code we look for until the end of the message.
	server_parse($socket, "354", __LINE__);

	// Send the Subject Line...
	if (!eregi ('Subject:',$subject)) fputs($socket, "Subject: $subject
");

	// Now the To Header.
	if (!eregi ('To:',$mail_to)) fputs($socket, "To: $mail_to
");

	// Now any custom headers....
	fputs($socket, "$headers

");

	// Ok now we are ready for the message...
	fputs($socket, "$message
");

	// Ok the all the ingredients are mixed in let's cook this puppy...
	fputs($socket, ".
");
	server_parse($socket, "250", __LINE__);

	// Now tell the server we are done and close the socket...
	fputs($socket, "QUIT
");
	fclose($socket);

	return TRUE;
}

?>[/php]
以下的修正, 提供您參考:

代碼: 選擇全部

-----[FIND]----------
// Ok now we tell the server we are ready to start sending data 
   fputs($socket, "DATArn"

-----[REPLACE]----------
// Ok now we tell the server we are ready to start sending data 
fputs($socket, "DATA
");
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
arti
星球公民
星球公民
文章: 52
註冊時間: 2003-09-28 09:00

文章 arti »

感謝心靈捕手老大的解答,
可是我這個smtp還沒修改時就已經是您說的修正。

再謝謝鳳凰寺 風老大我後台有做電子郵件設定,
如下圖。
圖檔
。。鳳凰寺 風。。
星球公民
星球公民
文章: 91
註冊時間: 2004-09-17 04:48
聯繫:

文章 。。鳳凰寺 風。。 »

你電子郵件設定好了,
你的問題有解決嗎= =?

(你是架在自己的電腦主機上嗎?)
如果驕傲沒被現實大海冷冷拍響,又怎會懂得要多努力才走得到遠方;
如果夢想不曾墜落懸崖千均一髮,又怎會曉得執著的人擁有隱形翅膀。
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8547
註冊時間: 2004-04-30 01:54
來自: Taiwan

文章 心靈捕手 »

arti 寫:感謝心靈捕手老大的解答,
可是我這個smtp還沒修改時就已經是您說的修正。
我剛剛回去看了一下"黃牌外掛"的安裝說明,
發現: 並不需要修正我所指出的地方啊,
也許是您安裝其他外掛時, 所做的修正吧!

我也有使用該外掛,
所以, 只是和自己的檔案, 做個比較而已.

建議您可以修改回去, 再測試看看! ;-)
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
arti
星球公民
星球公民
文章: 52
註冊時間: 2003-09-28 09:00

文章 arti »

。。鳳凰寺 風。。 寫:你電子郵件設定好了,
你的問題有解決嗎= =?

(你是架在自己的電腦主機上嗎?)
我不是架在自己電腦,應該是虛擬主機!
這站我是負責幫忙修外掛,
算是朋友的他是出錢的老大。

我進後台看如上面的貼圖,
看電子郵件有設定,
我就不知哪兒不對,
印象中以前架在2.0.6版或是10版沒有啟動電子郵件好像也沒此問題。

剛剛忙著裝竹貓的公告條,
有順便測試了一下,
本以為是這裡報告版面沒開啟,
結果還是一樣錯誤。
圖檔
arti
星球公民
星球公民
文章: 52
註冊時間: 2003-09-28 09:00

文章 arti »

心靈捕手 寫:
arti 寫:感謝心靈捕手老大的解答,
可是我這個smtp還沒修改時就已經是您說的修正。
我剛剛回去看了一下"黃牌外掛"的安裝說明,
發現: 並不需要修正我所指出的地方啊,
也許是您安裝其他外掛時, 所做的修正吧!

我也有使用該外掛,
所以, 只是和自己的檔案, 做個比較而已.

建議您可以修改回去, 再測試看看! ;-)
心靈捕手老大您說是再改smtp.php這個檔試試嗎?
我有改過了,
晚點如果沒有新答案就把這檔再重新改一次好了。
吉川拓也
竹貓忠實會員
竹貓忠實會員
文章: 1215
註冊時間: 2003-02-09 18:24
來自: [ G.I.T ]
聯繫:

文章 吉川拓也 »

Smtp 503 是指說有太多的收件者 ..
並請不要使用 hinet 的信箱寄送信件 ..
善用 搜尋 可以解決您 90% 的問題
頭腦清晰,選擇正確。 (╯▔︹▔)╯~╘═╛
arti
星球公民
星球公民
文章: 52
註冊時間: 2003-09-28 09:00

文章 arti »

吉川拓也 寫:Smtp 503 是指說有太多的收件者 ..
並請不要使用 hinet 的信箱寄送信件 ..
謝謝吉川拓也前輩!
那我這問題應該是後來啟動會員註冊的mail認證影響的嘍,
這有沒有方法可以改用PM通知管理員。
主題已鎖定

回到「外掛問題討論」