Comments (10)
To send via proxy you can use sock arg. For example:
from aiohttp_socks.proxy import create_proxy, ProxyType
proxy = create_proxy(
host=proxy["hostname"], port=proxy["port"], proxy_type=ProxyType.SOCKS5)
await proxy.connect(host, port)
await send(
message,
hostname=None,
port=None,
validate_certs=False, # for validate server_hostname should be passed to starttls.
username=source["username"],
password=source["password"],
start_tls=True,
sock=proxy.socket
)
`
from aiosmtplib.
Not currently, but I could have a look. What kind of proxy? SOCKS?
from aiosmtplib.
Http will be great, I'm using PySocks==1.6.7
to do the global http/socks proxy, but in production i just want to enable it for the email, I'll have a look at how to do the monkey patch correctly as well
from aiosmtplib.
Any changes?
aiohttp_socks
looks deprecated it's proxy.socket functionality.
old version of aiohttp_socks
does not allow to close socket
from aiosmtplib.
I was just going to add documentation for the sample above.
aiohttp_socks doesn't say deprecated in the repo, but it hasn't been updated in a while.
from aiosmtplib.
Oh yes I see.
Does aiosmtplib.send
close connection ?
I see a lot of problems with duplicating FD's when I pass a sock I got from aiohttp_socks's open_connection
-> writer
-> .get_extra_info('socket')
. It looks like lib closed the socket, but did not tell asyncio to delete the FD (writer.close()
).
Socket I put as param to .send
method has FD equal -1
after send operation.
from aiosmtplib.
Can you give example of usage aiosmtplib with socks, please?
from aiosmtplib.
@starfear the only example I have is the one above.
The send
API opens and closes the connection to the server each time it's called. I'm not sure how we would close the writer if you're just passing the socket.
Using the SMTP client class directly (https://aiosmtplib.readthedocs.io/en/latest/client.html) should give you control over when the connection is opened/closed so you can sync it up with the proxy connect.
from aiosmtplib.
Will this feature be added soon? Are there any alternatives to the above example?
And can you provide some information for adding proxy support to the library yourself?
from aiosmtplib.
Probably not unless someone is interested in contributing it. I'd accept a PR for documentation of how it works.
from aiosmtplib.
Related Issues (20)
- CancelledError thrown when trying to send without authentication HOT 2
- Enabling UTF-8 for Authetication HOT 5
- 4 failing tests HOT 7
- add github issues url to bug reporting docs section HOT 1
- [Debian] Please include CHANGELOG.rst in your pypi releases. HOT 2
- Please support choice of outbound IP address HOT 1
- Suggestion: Support 'TLS optional' usage HOT 3
- Add testing section to docs HOT 2
- Timed out waiting for server ready message HOT 3
- Error trying to use the mail_options or rcpt_options arguments HOT 1
- Do not receive emails using Bcc, Cc headers HOT 2
- Custom DNS resolver HOT 1
- aiosmtplib is not working. [SSL: WRONG_VERSION_NUMBER] wrong version number HOT 1
- packaging issue: deployment of tests HOT 1
- Operation-level timeout HOT 4
- Gives AttributeError when calling with when HOT 2
- Support LMTP HOT 3
- client.connect() call hangs after server timeout HOT 8
- Proxy support HOT 1
- TIP: HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiosmtplib.