EvilZone

Programming and Scripting => Scripting Languages => : fox12345 October 10, 2013, 06:08:57 AM

: How can I fetch emails through a proxy?
: fox12345 October 10, 2013, 06:08:57 AM
Dear friends,
I want to write basic program to send email. so i use this script. as well as want to use proxy. So how to do it? please help me ... "exactly i want to send email through a proxy or proxy chain" How to develop this code?

:
import smtplib
fromaddr = ''
toaddrs = ''
msg = ''
 
username = ''
password = ''
 
server = smtplib . SMTP ( 'smtp.gmail.com: 587' )
server. ehlo ( )
server. starttls ( )
server. ehlo ( )
server. login ( username , password )
server. sendmail ( fromaddr , toaddrs , msg )
server. quit ( )
: Re: How can I fetch emails through a proxy?
: proxx October 10, 2013, 06:27:27 AM
Well it depends.
If you want to send mail through plan smtp your are likely going to need the assistance of the ISP of that particular network.
Most networks dont allow you to send stuff from port 25 and if that works its likely gonna be considered spam.

The majority of ISP's Ive seen have a specific address like smtp.thisisp.com, so depending on the provider for that specific proxy you need a way to obtain this data.
Smacking it through google like that basically blows all the need for any proxy in general.
Apart from the fact that google (like all major companies) keep very good track of what is a proxy and what not, its big business.

I personally would take a low level approach in combination with a module such as this: http://socksipy.sourceforge.net/
Routing it to the 'local' smtp server to me seems like the best approach.

I would suggest reading about that module ^ and find a clever way of using it for your purpose.
(maybe there are native proxy solutions/modules for sending email , that would be the easy way :P )

: Re: How can I fetch emails through a proxy?
: Ragehottie October 20, 2013, 10:56:42 PM
I have used urllib2, but that was unnecessarily hard so I switched to Requests(http://www.python-requests.org (http://www.python-requests.org/en/latest/)). Super easy, Its now the only http library I use.
There also should be some examples to use proxies on the website
: Re: How can I fetch emails through a proxy?
: proxx October 20, 2013, 11:04:00 PM
I have used urllib2, but that was unnecessarily hard so I switched to Requests(http://www.python-requests.org (http://www.python-requests.org/en/latest/)). Super easy, Its now the only http library I use.
There also should be some examples to use proxies on the website

Thanks , wasnt aware of that.
requests looks pretty sweet.
+1
: Re: How can I fetch emails through a proxy?
: vezzy October 20, 2013, 11:08:47 PM
Thanks , wasnt aware of that.
requests looks pretty sweet.
+1

Odd.

It's extremely popular and recommended everywhere. Plenty of people even want it merged to the standard library. Personally though I never found the need for it, I've always been complacent with urllib2.

On the other hand, with Java it's a completely different story. Using java.net instead of Apache HttpComponents is pretty painful, though still manageable for smaller things.