Skip Menu |

This queue is for tickets about the Mail-IMAPClient CPAN distribution.

Report information
The Basics
Id: 1880
Status: resolved
Worked: 1 min
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: DJKERNEN__NO_SOLICITING__ [...] cpan.org
Requestors: raphael.langella [...] steria.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



From: "raphael langella" <raphael.langella [...] steria.com>
To: <bug-Mail-IMAPClient [...] rt.cpan.org>
Subject: F_GETFL and F_SETFL not defined under NT
Date: Tue, 17 Dec 2002 10:29:11 +0100
Hi, I'm using IMAPClient 2.2.5 with perl 5.8.0 build 804 under Windows NT 4.0 SP6.0a (french version). I'm running a simple script that connects to an Exchange 5.5 server and does a search. Here's the script : use Mail::IMAPClient; my $imap = Mail::IMAPClient->new( Server => 'X', User => 'X', Password=> 'X', Debug=> 1, ) or die "Cannot connect: $@"; #$imap->Fast_io(0); $imap->Peek(1); $imap->select('INBOX'); my @msgs = $imap->search(qq(UNANSWERED UNDELETED UNFLAGGED FROM "X" SUBJECT "X")) or die "cannot search $@"; print join(', ', @msgs); $imap->logout; And here's the output : Using Mail::IMAPClient version 2.2.5 and perl version 5.8.0 (5.008) Mail::IMAPClient not using Fast_IO; not available on this platform at test.pl line 5 Read: * OK La version 5.5.2653.23 (X) du serveur IMAP4rev1 Microsoft Exchange est prête Connect: Received this from readline: 0/OUTPUT/* OK La version 5.5.2653.23 (X) du serveur IMAP4rev1 Microsoft Exchange est prête Sending: 1 Login "XXXXXX" XXXXXX Sent 33 bytes Read: 1 OK LOGIN terminée. Sending: 2 SELECT INBOX Sent 16 bytes Read: * 48 EXISTS * 0 RECENT * FLAGS (\Seen \Answered \Flagged \Deleted \Draft) * OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft)] * OK [UNSEEN 2] Premier message non vu * OK [UIDVALIDITY 83] Valeur UIDVALIDITY. 2 OK [READ-WRITE] SELECT terminée. Sending: 3 UID SEARCH UNANSWERED UNDELETED UNFLAGGED FROM "X" SUBJECT "X" Sent 105 bytes Read: * SEARCH 3 OK SEARCH terminée. cannot search Your vendor has not defined Fcntl macro F_GETFL, used at e:/Perl/site/lib/Mail/IMAPClient.pm line 76. I also tried to run it with Fast_io turned off (as it looks like it's not available) and then here is my output : Using Mail::IMAPClient version 2.2.5 and perl version 5.8.0 (5.008) Mail::IMAPClient not using Fast_IO; not available on this platform at test.pl line 5 Read: * OK La version 5.5.2653.23 (X) du serveur IMAP4rev1 Microsoft Exchange est prête Connect: Received this from readline: 0/OUTPUT/* OK La version 5.5.2653.23 (X) du serveur IMAP4rev1 Microsoft Exchange est prête Sending: 1 Login "XXXXXX" XXXXXX Sent 33 bytes Read: 1 OK LOGIN terminée. Your vendor has not defined Fcntl macro F_SETFL, used at e:/Perl/site/lib/Mail/IMAPClient.pm line 90. Is there any way to make it work under NT? Thanks for your help. Raphaël Langella
[raphael.langella@steria.com - Tue Dec 17 04:29:05 2002]: Show quoted text
> > Your vendor has not defined Fcntl macro F_SETFL, used at > e:/Perl/site/lib/Mail/IMAPClient.pm line 90. > > Is there any way to make it work under NT? > Thanks for your help. >
Yes, I see exactly what is happening. I have already put the fix in the next release (it was a 30 second update!) but I'm afraid that the only way you will be able to get around this problem is to cheat. ;-) Instead of "$imap->Fast_io(0)", try this: $imap->{Fast_io} = 0; This will by-pass the Fast_io method (where the bug is living) but will give you the same result. Please let me know how this works for you. -- Cheers, Dave K.
[raphael.langella@steria.com - Tue Dec 17 04:29:05 2002]: By the way, I just wanted to add that your "search or die" syntax is probably the real cause of your script dying early. The fcntl message is just the last error you've received. The search method will return a false value if a successful search returns zero results, so you may want to do something like: my @msgs = $imap->search(@searchargs) or warn "No results from the search.\n"; This is similar to what the documentaion shows in the example, but in your version the documentation may be wrong, or not have an example. I can't remember when I put that example in but I think it was recently. Hope this helps... -- Dave K.
It looks like your server may not support the UIDPLUS capability, in which case APPEND will not return the uid of the appended message. You can verify this by running code like this: # connect to your server in the usual way, then: print "Has UIDPLUS\n" if $imap->has_capability("UIDPLUS"); If you don't have UIDPLUS then you will have to get the message number another way. One quick and dirty way is to get a count of the messages in the target folder ("Sent", I believe), do the append, and then get another count. If your count is one higher then your new message must be the last one. If it's not, you'll have to $imap->search("Sent",@searchargs) to find the newly appended message. I usually use the Message-Id header for this, but you can also use the subject or something like that. By the way, it looks like the original issue is resolved so I am closing this ticket. If you find another bug, you can report it as a new problem and I'll be able to track it correctly. If you have additional questions, you can send them to comment-Mail-IMAPClient@rt.cpan.org. Thanks for your feed back and good luck with your programming! -- Cheers, Dave K.