473,748 Members | 9,933 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Email attachments

Is there a way I can put a message together without having to download any
attachments there may be at the same time. I'm not having any problems dealing
with attachments, but the way I'm doing things makes me download the complete
message first, attachements and all:
mail = []
for j in M.retr(i)[1]:
mail.append(j.r strip())
inMail = email.message_f rom_string('\r\ n'.join(mail))

I don't have a real problem per se with this, it's just that I would just as
soon not download the attachments as well at first. Also I'm wondering, are my
attachments potentially dangerous at the state when I first get them as part of
the email, or are they not potentially dangerous until I binary write that part
of the message into a file(that's how I'm dealing with attachments, if I want
to keep an attachment in the already downloaded complete email, I just write it
to a file.
Jul 18 '05 #1
3 3145

lu************* @aol.com (LutherRevisite d) wrote:

Is there a way I can put a message together without having to download any
attachments there may be at the same time. I'm not having any problems dealing
with attachments, but the way I'm doing things makes me download the complete
message first, attachements and all:
mail = []
for j in M.retr(i)[1]:
mail.append(j.r strip())
inMail = email.message_f rom_string('\r\ n'.join(mail))

I don't have a real problem per se with this, it's just that I would just as
soon not download the attachments as well at first. Also I'm wondering, are my
attachments potentially dangerous at the state when I first get them as part of
the email, or are they not potentially dangerous until I binary write that part
of the message into a file(that's how I'm dealing with attachments, if I want
to keep an attachment in the already downloaded complete email, I just write it
to a file.

On POP3 mail servers, there are but two parts of the message; the header
and body. Some servers support the TOP command, which is used like so:
TOP <message> <bodylines>

With that command, you can get the headers and <bodylines> number of
lines from the body of the email message, on servers that support it.
Now, understand that in the case of POP3, the server does not understand
what you think of as an attachment. It is all just the body of the
email (likely encoded with base64), separated with section delimiters.

Also understand that the ordering of these "attachment s" can be
arbitrary (include the binary attachment, then the plain text email,
then the html email), so you may need to download the entire email to
get the plain text message body.

- Josiah

Jul 18 '05 #2
Thanks, I looked into TOP and it looks like I'll be able to handle that issue
satisfactorily with at least one, maybe many, but not all servers. POP3 is not
looking good to me now, but with Yahoo what can you do....
Jul 18 '05 #3

lu************* @aol.com (LutherRevisite d) wrote:
Thanks, I looked into TOP and it looks like I'll be able to handle that issue
satisfactorily with at least one, maybe many, but not all servers.
Perhaps you missed the later part of my post when I explained that the
location of attachments can be arbitrary. That is, attached files can
come before what most people consider to be the body of the email (text
like what you are reading now). At best, using TOP is a 95% solution.
The 100% solution is to just download the email and call it good.

If you merely care whether there is an attachment or not, deciding based
on the size of an email (the sizes returned by LIST) can be reasonable.

POP3 is not looking good to me now, but with Yahoo what can you do....


Well, with Yahoo, you can only access them via POP3 if you have paid for
their services.

Really, mail access comes down to the simple maildrop approach that is
all client-side (POP3), or the complicated server handles everything
approach (IMAP4).

With a simple approach comes a simple protocol. POP3 servers and
clients can be implemented in an afternoon, and I have done so a few
times (it is what I get paid to do).

The IMAP4 spec is huge, and allows asynchronous command processing (the
server can reply to command B before command A when command A was given
first), which complicates matters. Having written partial IMAP4 servers
and clients, I will tell you that it is not really approachable in
anything less than a weekend.

I believe that the reason why very few large webmail providers offer
IMAP4 access is due to the protocol being very difficult to get right,
and because POP3 does most of what is necessary.
In my opinion, what is really needed is a protocol that sits between
POP3 and IMAP4. POP3 with folder support and a few other little pieces
would be sufficient to implement all the protocol necessary for a
full-on webmail service with the features of both Gmail and Yahoo Mail.
Unfortunately, the liklihood of this happening and becoming widespread
is very low; both the POP3 and IMAP4 RFCs have been around for quite a
while, and many among the email community believe that they are
sufficient.

Ah well...
- Josiah

Jul 18 '05 #4

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

Similar topics

4
3731
by: Paul Schmidt | last post by:
Dear list: I am new to python, and I am trying to figure out the short answer on something. I want to open a POP3 mailbox, read the enclosed mail using the POP3 module, , and then process it using the email module. Environment Python 2.3.4, Mandrake Linux 9.0 patched up the wazoo...
5
12729
by: morphex | last post by:
Hi, I have an email that's in the utf-8 encoding, and I'm getting this error message when I try to send it using smtplib: * Module smtplib, line 688, in sendmail * Module smtplib, line 485, in data * Module smtplib, line 312, in send * Module socket, line 1, in sendall
5
15934
by: paii, Ron | last post by:
How do I setup a email with attachment for preview but require the user to push the SEND button in Outlook. I have the following function but it sends the email without the sender ever seeing it. Public Function PrintPDFemail2() ' This will create the PDF if the report is setup for it DoCmd.OpenReport "rptJobItemStat", acViewNormal
4
1940
by: Russell Bungay | last post by:
Hello all, I have written a short function, based on a recipe in the Python Cookbook, that sends an e-mail. The function takes arguments that define who the e-mail is to, from, the subject, the body and an optional list of attachments. The function works also perfectly, bar one slight problem. If you attempt to send an e-mail with just a body and no attachments, the receiving client still thinks that there is an attachment (so far...
1
2903
by: mike11d11 | last post by:
If someone could help me, I need to be able to send attachments from my access database that I have created. This database runs queries then generates a report off the queries from underlying tables and emails the reports as HTML format in the body, I then need to have this same process go out to my C:\ drive and pick up a couple files and add it to the same email as attachments. If someone could please give me a sample code that would...
10
4970
by: OdAwG | last post by:
Hello All, Is it possible to send an email from Access? I found a Microsoft article on how to do this but I keep getting an error "RUNTIME ERROR 438" -- Object doesn't support this property or method. Listed below is the article from microsoft How to use a recordset to send Outlook e-mail to multiple recipients in Microsoft Access http://support.microsoft.com/?id=318881
2
2647
by: oyster | last post by:
I find that the existing email moudle is some hard for me to understand, especially the part of how to set the CC, BCC and attach the files. Is there any more easy one like this p-code? import easyemail smtpserver=easyemail.server('something') smtpserver.login('usr@gmail.com', pwd) newletter=smtpsever.letter(smtpserver) newletter.sendto= newletter.sendcc=
1
399
by: Steve Holden | last post by:
I'm having some trouble getting attachments right for all recipients, and it seems like Apple's mail.app is the pickiest client at the moment. It doesn't handle attachments that both Thunderbird and Outlook find perfectly acceptable. Since the code I'm using is currently ugly and embedded, before I trim it down for posting could anyone who's successfully generated emails with attachments received by mail.app let me know if they had any...
1
3876
by: budyerr | last post by:
All, I am trying to build a email submission form using asp.net. I currently have a web form page that will upload to my webhosting server, attach to email then delete the file after sending. This works great with one attachment. I am requiring that a file be attach before submitting. Now I am trying to add the ability to add multiple attachments and I am able to create this however, it will error out if all of the attachment is not...
0
8831
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,...
0
9548
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...
1
9325
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,...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8244
agi2029
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...
1
6796
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
4607
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...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2215
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.