Replying to my own message. Oh, well.

  First off, you have to believe me. I ABSOLUTELY tried what was suggested in 
the previous
  message thread by Dan Donnelly of substituting '\r\n' for '\n' and it failed. 
Upon installing
  IMAP::Simple and successfully connecting, I pulled the Perl module apart and 
discovered it was
  using the '\r\n' sequence as well. I then desided, oh well, I'm ready to try 
it again. LOW and
  behold! It worked.

  So, I guess my script will have to look for the IMAIL greeting in the 
connection response and
  use '\r\n' while ALL of the other servers I've connected to use just '\n'. 
Most of what I do
  is developed with a cross-platform mind set.

  I have thus removed the test account that could be found in the attached 
packet trace file.

  Thanks to Eric Shanbrom for making me rack my brain and Dan Donnelly for the 
suggestion in the
  previous thread.

  Dan, I absolutely don't know why it didn't work before and now it is. Hmm... 
Oh, well.

On Friday, March 18, 2005 at 7:06:27 PM, [EMAIL PROTECTED] confabulated:


> On Friday, March 18, 2005 at 5:43:28 PM, [EMAIL PROTECTED] confabulated:

>> I would have to look at this line:

>>  print $REM_IMAP "x LOGIN [EMAIL PROTECTED] password\n";

>> What are you populating the "x" variable with.

>   This is not a variable. You have to prefix ALL IMAP commands issued with 
> something. That
>   something is then used to determine when the server has completed the IMAP 
> command. The
>   server, upon completion, will respond with:

>       OK - login completed, now in authenticated state
>       NO - login failure: user name or password rejected
>       BAD - command unknown or arguments invalid
      
>   This is the example RFC3501 gives ('C' is client and 'S' is server and 
> notice the LOGIN
>   command is prefixed with 'a001'):

>       C: a001 LOGIN SMITH SESAME
>       S: a001 OK LOGIN completed

>> This needs to be a positive integer..Is that happening?

>   According to the examples in RFC3501, this would not be the case (I'm at 
> least assuming by the
>   examples).

>> I would like to see the trace from ethereal....

>   I'm going to be trusting. Attached to this message is the capture of the 
> communication between
>   two servers over IMAP that fails the LOGIN. The account used to login is a 
> test account that I
>   set up.

>> I am going to be out of the
>> office and out of touch until at least tomorrow but will try to look at it
>> sometime this weekend...You can send the traces to me directly if need be but
>> I'm sure someone else here can look at them as well

>> Eric S


>> ----- Original Message ----- 
>> From: "Duane Hill" <[EMAIL PROTECTED]>
>> To: <[email protected]>
>> Sent: Friday, March 18, 2005 11:57 AM
>> Subject: [IMail Forum] IMAP Connection Using Perl [Revisited]


>>>
>>>   Ok. I'm starting over and going to explain this slowly. First, I can
>> successfully telnet into
>>>   our IMail server via IMAP port 143 and login and logout fine. However,
>> when I attempt to use
>>>   ActiveState Perl v5.8.4 and the Perl module IO::Socket the login fails.
>> The connection itself
>>>   does succeed without error. I have listed below the secion of code again
>> with the values hard
>>>   coded. I have marked up the code below to show what the responses from
>> IMail are at each step.
>>>   I have also commented everything to include as much detail in an attempt
>> to explain what goes
>>>   on with the script.
>>>
>>>


>> # --------------------------------------------------------------------------
>> ----------------
>>>   # This section is what establishes the connection to IMail via IMAP
>> using Perl.
>>>
>>>   # This creates a new IMAP connection to 63.110.140.31 using port 143
>> (IMAP). If the connection
>>>   # is not successfull, the script will at this point die.
>>>
>>>   $REM_IMAP = new IO::Socket::INET( PeerAddr => '63.110.140.31',
>>>                                     PeerPort => 143
>>>                                   ) || die "Can't connect to remote server
>> via IMAP\n";
>>>
>>>   # This will force the $REM_IMAP to flush after every print.
>>>
>>>   $REM_IMAP->autoflush(1);
>>>
>>>   # Now, we loop through the responses from IMail until we get the final
>> response.
>>>
>>>   do {
>>>     $IMAPResponse = <$REM_IMAP>;
>>>     print "$IMAPResponse\n"; # -----> This is here for debugging purposes.
>>>   } until($IMAPResponse =~ /^\* /);
>>>
>>>   #####  At this point, IMail has given the response "* OK IMAP4 Server
>> (IMail 8.15)" and
>>>   #####  this is the ONLY response that is received.
>>>
>>>
>>>


>> # --------------------------------------------------------------------------
>> ----------------
>>>   # This section is what performs the login to an e-mail account via IMAP
>> using Perl. So, at
>>>   # this point, the actual socket connection to IMail has succeeded 100%
>> without error.
>>>
>>>   # We now want to send to the socket connection the IMAP command to
>> login. The '\n' (newline)
>>>   # is needed at the end to signify the end of the input stream. On
>> Windows, '\n' is translated
>>>   # to <CRLF>.
>>>
>>>   print $REM_IMAP "x LOGIN [EMAIL PROTECTED] password\n";
>>>
>>>   # Again, we loop through the responses from IMail until we get the final
>> response that begins
>>>   # with 'x'. That is what we used in the line to login. Any character
>> sequence can be used. It
>>>   # is what assigns a unique value to the particular IMAP command issued.
>> IMail should respond
>>>   # to us each step of its way with responses starting with this value.
>>>
>>>   do {
>>>     $IMAPResponse = <$REM_IMAP>;
>>>     print "$IMAPResponse\n"; # -----> This is here for debugging purposes.
>>>   } until($IMAPResponse =~ /^x /);
>>>   die "Can't login to remote IMAP: $IMAPResponse\n" unless($IMAPResponse
>> =~ /^x OK/);
>>>
>>>   #####  At this point, IMail has given the response "x BAD LOGIN Invalid
>> Syntax" and
>>>   #####  this is, again, the ONLY response that is received. With the
>> response not matching
>>>   #####  what we are looking for, the script dies because we have NOT
>> successfully logged into
>>>   #####  the e-mail account.
>>>
>>>


>> # --------------------------------------------------------------------------
>> ----------------
>>>
>>>   I have also started up Ethereal to sniff the line BOTH on the telnet
>> session as well as the
>>>   Perl script session. BOTH do not look any differant than the other. I
>> have also, again, done
>>>   the same to two other MTA's we run here and they BOTH have no issues
>> with the login sequence.
>>>

-----

Duane Hill
Sr E-Mail Administrator
http://www.yournetplus.com


To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/

Reply via email to