top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Python performance with SMTP-Relay script

0 votes
427 views

I have to write a small SMTP-Relay script (+ some statistic infos) and I'm wondering, if this can be done in python (in terms of performance, of course not in terms of possibility ;) ).

It has to handle around 2000 mails per hour for at least 8hours a day (which does not mean, that it is allowed not to respond the rest of the day.

Can this be done? or should I better use some other programming language? My second choice would be erlang.

posted Aug 2, 2013 by Deepak Dasgupta

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

I suspect it depends on a lot of factors:

  • will your network connection support that much traffic? (And an ISP that will grant you permission to spew that volume of email?)

  • are these simple text emails, or are they large with lots of attachments, inline images, PDFs, or whatever?

  • are the statistics that you're gathering simple, or do they require complex analysis of the documents passing through?

  • is the load 8hr straight of spewing email, or is it bursty? If it's bursty, you can internally queue them up when load gets high, delivering them from that queue when load diminishes. Given the store-and-forward nature of email, there's no guarantee that if you spewed them at ~33/minute (that/s a little faster than one
    every two seconds), they'd arrive at their destination any faster than if you'd queued them up and sent them at a more steady rate.

That said, sending ~33 text emails per minute doesn't seem impossible, it just depends on your configuration (network, DNS, and receiving SMTP server(s) throttling/setup)

answer Aug 2, 2013 by Majula Joshi
Similar Questions
0 votes

Every once in a while, my ISP's SMTP server refuses to send perfectly legit e-mails because it considers them as SPAM.

So I'd like to install a dead-simple SMTP server on my XP computer just to act as SMTP backup server. All I'd need is to change the SMTP address in my e-mail client, and off they go. No need for anything else like user authentication or SPAM control.

Is there a no-brainer, ready-to-use solution in Python that I could use for this?

0 votes

I am having Bugzilla 4.0.2 i want to specify SMTP port address But in Bugzilla there is no option for Port Address Please Let me know how to enter Port address for SMTP

SMTP port addrress is 587

+9 votes

Explain the following terms: DNS, SMTP, HTTP, FTP, Hub, Switch, Firewall, BOOTP, DHCP, SNMP?
Please mention the standard port numbers for these terms.

0 votes

I am trying to use mitmproxy behind a company proxy that requires a user/password login.

The setup is: Local PC's browser -> mitmproxy (on local PC) -> company proxy -> internet.

Based on this SO thread, this is how you use mitmproxy within a Python program. This example works fine when there's no proxy.

from mitmproxy.options import Options
from mitmproxy.proxy.config import ProxyConfig
from mitmproxy.proxy.server import ProxyServer
from mitmproxy.tools.dump import DumpMaster

class Addon(object):
    def __init__(self):
        pass

    def request(self, flow):
        # examine request here 
        pass

    def response(self, flow):
        # examine response here
        pass


if __name__ == "__main__":

    options = Options(listen_host='0.0.0.0', listen_port=8080, http2=True)
    m = DumpMaster(options, with_termlog=False, with_dumper=False)
    config = ProxyConfig(options)

    m.server = ProxyServer(config)
    m.addons.add(Addon())

    try:
        print('starting mitmproxy')
        m.run()
    except KeyboardInterrupt:
        m.shutdown()

Assuming the company proxy is at IP "1.2.3.4" port 3128 and requires a login USER and PASSWORD, how can I change this script to have mitproxy use that proxy instead of going to the internet directly?

Addition info: I am not using mitmdump with the script-parameter to run this script. The goal is to run this from Python 3.8 with a pip-installed mitmproxy

...