Giter VIP home page Giter VIP logo

Comments (9)

b3mb4m avatar b3mb4m commented on May 20, 2024 3

Just anohter mail related feature to add, nothing special

yag = yagmail.SMTP('mygmailusername', 'mygmailpassword', 'myproxy)

from yagmail.

kootenpv avatar kootenpv commented on May 20, 2024 1

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?

from yagmail.

kootenpv avatar kootenpv commented on May 20, 2024

I don't understand the relation to yagmail?

from yagmail.

xk7612 avatar xk7612 commented on May 20, 2024

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.

from yagmail.

kootenpv avatar kootenpv commented on May 20, 2024

@xk7612 I have no idea to be honest.

Maybe you could try socks.wrapmodule(yagmail.smtplib)?

from yagmail.

chenerg avatar chenerg commented on May 20, 2024

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

from yagmail.

kootenpv avatar kootenpv commented on May 20, 2024

@chenerg Did this code snippet work for you? Then indeed maybe we can add it like this:

yagmail.SMTP(..., proxy="myproxy.proxy.com:8080")

from yagmail.

mesondzh avatar mesondzh commented on May 20, 2024

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

from yagmail.

kootenpv avatar kootenpv commented on May 20, 2024

@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!

from yagmail.

Related Issues (20)

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.