473,624 Members | 2,612 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

POP3 Python Mail Download

Having some troubles downloading messages with POP3...

I can connect to the server just fine and list messages without any
problem with the following code:

------------------------
from poplib import *

server = POP3("mail.blue bottle.com")
print server.getwelco me()
print server.user("ne *******@bluebot tle.com")
print server.pass_("n eurogasm")

messagesInfo = server.list()[1]
numMessages = len(messagesInf o)

print numMessages
------------------------

However, if I try to actually download the messages themselves, my
python editor highlights 'msgSize' and says "invalid syntax" when I run
the following subsequent lines of code:
------------------------
emails = []
for msg in messagesInfo:
msgNum = int(split(msg, " ")[0]
msgSize = int(split(msg, " ")[1]
if(msgSize < 20000):
messages = server.retr(msg Num)[1]
messages = join(message, "\n")
emails.append(m essage)
------------------------

anyone know what's wrong? thanks.
Mar 18 '06 #1
1 1730
Kevin F wrote:
However, if I try to actually download the messages themselves, my
python editor highlights 'msgSize' and says "invalid syntax" when I run
the following subsequent lines of code:
------------------------
emails = []
for msg in messagesInfo:
msgNum = int(split(msg, " ")[0]
msgSize = int(split(msg, " ")[1]


You have an inconsistent indent in the two lines above. All the lines in
a block must have the same indent (except sub-blocks of course).

Kent
Mar 18 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1974
by: WebRod | last post by:
Hi everybody, I just would like to download the new mails I received on my POP3 server (and keep a copy on the server) I use PHP 4.3 and IMAP functions (they are compatible with both POP3 and IMAP servers). When I use OUTLOOK, no problem, in less than 5 seconds, it answers me: " you have XX new messages"
6
2471
by: Robin Becker | last post by:
Hi, I'm getting vast numbers of fake upgrade emails containing some kind of virus. My rather old client can be made to reject these based on some patterns in the subject line. They're nearly all based on the word 'New', 'Latest', 'Microsoft', 'Patch', 'Pack', ... etc etc. Is there a python tool that can be made to delete these from my POP3 mail box rather than let my client reject? Quite a few seem to have semi-valid return addresses so...
2
2826
by: Mike Brearley | last post by:
I need to write a script that will check a catch-all mailbox (pop3) and send a non delivery report back to the sender of the email. Background info: I have a domain hosted on a site that offers unlimited email accounts... the problem is, emails sent to an invalid address on the domain aren't automatically returned as non-deliverable. I am, however, able to set up a catch-all address and able to pick up those emails. Id like to set up a...
0
3428
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
Like many people, I normally use Yahoo! Mail via the web and like to keep all my emails stored on the Yahoo! server. However sometimes I can’t get access to a PC/the web and I download my emails to a PDA/palmtop via POP3. The PDA uses Windows Mobile software. Since using the PDA, I have had the problem of emails disappearing from the Yahoo! server. However I think I now understand how to avoid this. It seems that Windows Mobile is...
0
8246
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8685
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8631
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6112
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
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();...
0
4084
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...
1
2612
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
1
1796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1489
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.