Giter Club home page Giter Club logo

envelopes's People

Contributors

tomekwojcik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

envelopes's Issues

To and from

This can be made even more humanistic by using to and from instead of to_addr and from_addr since "address" is usually implied when talking about email.

You could then allow to to accept a list as well as a single string without having to add another argument.

Be able to use host kwarg in send method

I am not sure if this deserves an Issue and you can close it if you feel so, I will not complain :)

The fact is I made my report class using your excellent Envelope library (not subclassing) and I wanted to pass connection arguments as a dictionary from a class attribute. Then I see that host is not a kwarg, it feels "odd" is the only one, do you agree?

Cheers.

Not sure if library is broken still?

I've tried with 3 different SMTP providers: gmail.com, smtp.com and fastmail.fm and none of their published settings are sending messages, so I thought I'd ping.

suggestion about Envelope.add_attachment

  1. Envelope.add_attachment could accept pathlib.Path object
  2. if the path is a folder, then compress it and send the compressed file.
    Following is a part of my command line tool
path = args.pathname
if path:
    if path.is_dir():
        # compress the folder before submitting
        # compressed file is named by subject
        compath = path.parent / (args.subject+".7z")
        subprocess.run(["7z", "a", "-t7z", compath, path])
        envelope.add_attachment(str(compath))
    elif path.is_file():
        envelope.add_attachment(str(path))

    envelope.send(...)
    print('The email is sent to ...')

    if path.is_dir(): # delete the compressed file finally
        os.remove(compath)

Fails when attaching HTML file

I am trying to attach an HTML file to an email.

I get the following error:

/usr/local/lib/python2.7/email/message.pyc in get(self, name, failobj)
    358         is missing.
    359         """
--> 360         name = name.lower()
    361         for k, v in self._headers:
    362             if k.lower() == name:

AttributeError: 'slice' object has no attribute 'lower'

Stepping into the code with ipython debugger it seems that it detects the MIME type of the file, correctly, as text/html but this causes it to follow a different codepath which is where it fails: https://github.com/tomekwojcik/envelopes/blob/master/envelopes/envelope.py#L292

If I force it to use a generic mime type instead:
envelope.add_attachment("myfile.html", mimetype="application/octet-stream")

...then I can send the message but something weird happens - Gmail shows the message as having the file attached twice, even though if I go back and check the envelope object it seems I have only one attachment:

In [18]: envelope._parts
Out[18]:
[('text/plain', 'my body text', 'utf-8'),
 ('application/octet-stream',
  <email.mime.base.MIMEBase instance at 0x270cd40>)]

Envelopes supports Python 2.6, 2.7 and 3.3?

according to the docs:

Envelopes has been developed and tested with Python 2.7. Currently, Envelopes supports Python 2.6, 2.7 and 3.3.

Most people upgraded to Python3 these days. I guess above line needs an upgrade. Python 3.3 is dated.

add_attech method with file suffix '.txt' error

add_attech method with file’s suffix like '.txt' will be called something like this
File "/usr/lib/python2.6/site-packages/envelopes/envelope.py", line 329, in send
send_result = conn.send(self)
File "/usr/lib/python2.6/site-packages/envelopes/conn.py", line 87, in send
msg = envelope.to_mime_message()
File "/usr/lib/python2.6/site-packages/envelopes/envelope.py", line 292, in to_mime_message
msg.attach(MIMEText(part[1], type_min, self._charset))
File "/usr/lib64/python2.6/email/mime/text.py", line 30, in init
self.set_payload(_text, _charset)
File "/usr/lib64/python2.6/email/message.py", line 224, in set_payload
self.set_charset(charset)
File "/usr/lib64/python2.6/email/message.py", line 268, in set_charset
self._payload = charset.body_encode(self._payload)
File "/usr/lib64/python2.6/email/charset.py", line 387, in body_encode
return email.base64mime.body_encode(s)
File "/usr/lib64/python2.6/email/base64mime.py", line 147, in encode
enc = b2a_base64(s[i:i + max_unencoded])
File "/usr/lib64/python2.6/email/message.py", line 292, in getitem
return self.get(name)
File "/usr/lib64/python2.6/email/message.py", line 358, in get
name = name.lower()
AttributeError: 'slice' object has no attribute 'lower'

other suffix seems ok.

Is this still active?

I can see that there is no more development happening here since 2014. On the other hand, @vamega has an active fork.

Is there any plan to merge?

How about pushing vamega's changes to pypi? It contains a BIG feature (attaching from streams instead of files).

"multipart/alternative" will not display in some email client

I use envelopes in our project.
I found a bug:some attachment disappear in some email client (Airmail exactly)when I send email use envelopes.
I try to fix this bug,and I realize the following source is origin
https://github.com/tomekwojcik/envelopes/blob/master/envelopes%2Fenvelope.py#L276

msg = MIMEMultipart('alternative')

I inherit envelopes class and rewrite to_mime_message() function,then bug fixed

msg = MIMEMultipart('mixed')

RFC 1341 7.2.3 say:

The multipart/alternative type is syntactically identical to multipart/mixed, but the semantics are different. In particular, each of the parts is an "alternative" version of the same information. User agents should recognize that the content of the various parts are interchangeable. The user agent should either choose the "best" type based on the user's environment and preferences, or offer the user the available alternatives. In general, choosing the best type means displaying only the LAST part that can be displayed.

So why envelopes project use multipart/alternative type instead multipart/mixed?Is it a bug?

Allow adding attachment from memory

Sometimes I have a file in-memory, not saved to disk, and I'd like to add it as an attachment.

Currently add_attachment only works on files that are saved to the filesystem.

Please allow attaching files that are in-memory.

How to add attachment's headers

I want to send html_body with image src .
html_body=u'<html><body><h1>Hello</h1><p><img src="cid:screenshot.png"></p></body></html>'
use src="cid:screenshot.png" I need to add a image attachment:
envelope.add_attachment(r'D:\XXX\screenshot.png')
and I need add a header ('Content-ID', ‘screenshot.png’) to this attachment.
but I don't konw how to add attachment's headers in envelopes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.