|
From: Paul S. O. <ps...@us...> - 2002-02-04 14:32:45
|
Update of /cvsroot/phpbb/phpBB2/includes
In directory usw-pr-cvs1:/tmp/cvs-serv28039/includes
Modified Files:
smtp.php
Log Message:
Added AUTH LOGIN support for smtp ... requires smtp_username and smtp_password fields in config ... this DOESN'T support CRAM-MD5 or ODMR type authentication
Index: smtp.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/includes/smtp.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** smtp.php 2002/01/31 21:16:12 1.9
--- smtp.php 2002/02/04 14:32:41 1.10
***************
*** 37,45 ****
function server_parse($socket, $response)
{
! 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__);
--- 37,46 ----
function server_parse($socket, $response)
{
! 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__);
***************
*** 137,144 ****
// Send the RFC821 specified HELO.
fputs($socket, "HELO " . $board_config['smtp_host'] . "\r\n");
-
- // From this point onward most server response codes should be 250
server_parse($socket, "250");
// Specify who the mail is from....
fputs($socket, "MAIL FROM: " . $board_config['board_email'] . "\r\n");
--- 138,156 ----
// Send the RFC821 specified HELO.
fputs($socket, "HELO " . $board_config['smtp_host'] . "\r\n");
server_parse($socket, "250");
+ if( !empty($board_config['smtp_username']) && !empty($board_config['smtp_password']) )
+ {
+ fputs($socket, "AUTH LOGIN\r\n");
+
+ server_parse($socket, "334");
+ fputs($socket, base64_encode($board_config['smtp_username']) . "\r\n");
+ server_parse($socket, "334");
+ fputs($socket, base64_encode($board_config['smtp_password']) . "\r\n");
+
+ server_parse($socket, "235");
+ }
+
+ // 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'] . "\r\n");
***************
*** 211,215 ****
// Now tell the server we are done and close the socket...
! fputs($socket, "quit\r\n");
fclose($socket);
--- 223,227 ----
// Now tell the server we are done and close the socket...
! fputs($socket, "QUIT\r\n");
fclose($socket);
***************
*** 217,219 ****
}
! ?>
--- 229,231 ----
}
! ?>
\ No newline at end of file
|