Open b3mb4m opened 8 years ago
I don't understand the relation to yagmail?
Just anohter mail related feature to add, nothing special
yag = yagmail.SMTP('mygmailusername', 'mygmailpassword', 'myproxy)
Oh I have overseen this last message. Could you perhaps give an example for a proxy, I think it would be interesting way. Would we we need an extra library for this functionality?
I found this online:
import smtplib
import socks
#socks.setdefaultproxy(TYPE, ADDR, PORT)
socks.setdefaultproxy(socks.SOCKS5, 'proxy.proxy.com', 8080)
socks.wrapmodule(smtplib) # in our case yagmail
<continue with yagmail like usual>
Is something like how you had it in mind?
I tried to send email with socks5 proxy, here is the code: socks.setdefaultproxy(socks.SOCKS5, 'proxy.proxy.com', 1080) socks.wrapmodule(yagmail)
Got AttributeError: module 'yagmail' has no attribute 'socket', how to fix this issue? @kootenpv Thank you.
@xk7612 I have no idea to be honest.
Maybe you could try socks.wrapmodule(yagmail.smtplib)
?
Oh I have overseen this last message. Could you perhaps give an example for a proxy, I think it would be interesting way. Would we we need an extra library for this functionality?
I found this online:
import smtplib import socks #socks.setdefaultproxy(TYPE, ADDR, PORT) socks.setdefaultproxy(socks.SOCKS5, 'proxy.proxy.com', 8080) socks.wrapmodule(smtplib) # in our case yagmail <continue with yagmail like usual>
Is something like how you had it in mind?
this is great
@chenerg Did this code snippet work for you? Then indeed maybe we can add it like this:
yagmail.SMTP(..., proxy="myproxy.proxy.com:8080")
Oh I have overseen this last message. Could you perhaps give an example for a proxy, I think it would be interesting way. Would we we need an extra library for this functionality?
I found this online:
import smtplib import socks #socks.setdefaultproxy(TYPE, ADDR, PORT) socks.setdefaultproxy(socks.SOCKS5, 'proxy.proxy.com', 8080) socks.wrapmodule(smtplib) # in our case yagmail <continue with yagmail like usual>
Is something like how you had it in mind?
@kootenpv thank you, I try to rewrite yagmail.SMTP, it works! yagmail_proxy_example
@ds19991999 So we could add the keyword argument proxy
to yagmail.SMTP
and in the init run the set_proxy
method if proxy is not None? If you want you can make a PR and I'd accept it!
ps : socks project is clearly not working and outdated,