I'm trying to use the following code to get my remote server's folder
size information. Unfortunately, i'm getting the error:
Traceback (most recent call last):
File "/Life/School/Homework/Spring 2006/OPIM
399/Tutorial/IMAP/mailboxsize.py" , line 23, in -toplevel-
number_of_messa ges_all += int(number_of_m essages[0])
ValueError: invalid literal for int(): The requested item could not be
found.
What seems to be the problem?
My code is here:
import sys, os, string, imaplib, getpass
imap_server = "webmail.xxxxx. xxxxx.edu"
# Open a connection to the IMAP server
M = imaplib.IMAP4_S SL(imap_server)
M.login('xxxx', getpass.getpass ())
# The list of all folders
result,list = M.list()
print "%-30s%5s%10s\n" % ("Folder", "# Msg", "Size")
number_of_messa ges_all = 0
size_all = 0
for item in list[:]:
x = item.split()
mailbox = string.join(x[2:])
# Select the desired folder
result, number_of_messa ges = M.select(mailbo x, readonly=1)
number_of_messa ges_all += int(number_of_m essages[0])
size_folder = 0
# Go through all the messages in the selected folder
typ, msg = M.search(None, 'ALL')
# Find the first and last messages
m = [int(x) for x in msg[0].split()]
m.sort()
if m:
message_set = "%d:%d" % (m[0], m[-1])
result, sizes_response = M.fetch(message _set, "(UID RFC822.SIZE)")
for i in range(m[-1]):
tmp = sizes_response[i].split()
size_folder += int(tmp[-1].replace(')', ''))
else:
size_folder = 0
print "%-30s%5d%10s" % (mailbox, int(number_of_m essages[0]),
size_folder);
size_all += size_folder
print "\n%-30s%5i%10.3f MB\n" % ("Sum", number_of_messa ges_all,
size_all/1e6)
# Close the connection
M.logout() 0 1602 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Fabian Müller |
last post by:
Hello,
I would like to access (open) my remote IMAP Mailbox with the
imap_open() function in PHP Version 5.0.4. The Mailbox is located at
the german provider freenet.de.
The imap_open() function does not produce an error message as you can
see below. But when I call the imap_headers() function the warning
message mentioned in the subject as well as below is returned.
|
by: dekoffie |
last post by:
Hello there,
I'm trying to create a connection with an IMAP server which is secured
through SSL. I can get the connection just fine, and I get a first respone
from the server. But then I send out my login string, and it does not seem
to arrive at the server, because I don't get an answer returned! After some
time, I receive a message from the server saying that I've been idle for too
long, and then the connection gets closed..
But why...
|
by: nh_capricorn |
last post by:
Hi,
I am fairly new to .NET (coming from a Java background) and I am trying to
port an application that I originally wrote in Java, to .NET / C#. My problem
is that I cannot find a C# analog for the javax.mail library. My original
program used this to access the calendar on Exchange, via IMAP and retrieve
appointments.
I have no idea how to do this. Any help, advice, or even general guidelines
would be much appreciated. I would be...
|
by: necroph |
last post by:
Hello everybody,
i am using an imap-component to read e-mails from an exchange-Server.
This is allready done. My problem is that the content of that mails
looks confusing. My first try was just to put all the text into a
RichTextBox.
This looks like That:
This is a multi-part message in MIME format.
|
by: Kevin F |
last post by:
I'm trying to use the following code to get my remote server's folder
size information. Unfortunately, i'm getting the error:
Traceback (most recent call last):
File "/Life/School/Homework/Spring 2006/OPIM
399/Tutorial/IMAP/mailboxsize.py", line 23, in -toplevel-
number_of_messages_all += int(number_of_messages)
ValueError: invalid literal for int(): The requested item could not be
| |
by: Kevin F |
last post by:
I've been trying to implement this script, it polls an IMAP inbox for
unread messages and displays the sender and subject in a scrollable
window using Tkinter. However, when I try to change the search
parameters on line 55 from 'unread' (UNSEEN) to 'read' (SEEN), the
tkinter window doesn't even pop up anymore.
Any idea how to change the parameters of this program and yet still keep
it functional?
|
by: Kun |
last post by:
Hey guys, I would like to have a code in python (as simple as possible)
to scan a specific folder in my mailbox and if the subject is equal to,
say, 'BIKES', I would like to have the code automatically send the
SENDER an email saying something like "We have received your Email".
Furthermore, I would also like to somehow save the sender's email into a
list which would be compiled by another python program into an html file
that would show a...
|
by: slimdizzy |
last post by:
I have a bit of code that when using POP in the imap_open connect
string it will return the filenames of the attachments, but when using
IMAP it does not.
Been racking my brain over this for a week now and decided to ask in
here for some help.
CODE:
// open mailbox
$inbox = @imap_open("{" . $SESSION_EMAILSERVER .
|
by: kpfunf |
last post by:
I have the following code that works in accessing my personal folder inbox and subfolders.
Option Explicit
Sub SaveAttachmentsToFolder()
On Error GoTo SaveAttachmentsToFolder_err
' Declare variables
Dim ns As NameSpace
Dim Inbox As MAPIFolder
Dim SubFolder As MAPIFolder
Dim SubSubFolder As MAPIFolder
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |