[Ncr-Python.in] [ilugd][NCR-PYTHON]Mail Server Creation in Python
Dear All, I have to start a project for our internal purpose and that is we have to create a MTA which will take data from our database(like from, to, message etc.) and will transfer/receive it to/from other ISPs (e.g. google mail, yahoo mails). The problem which i think could arise is, our peak time value for sending/receiving mails would be 5K mails/sec. I can develop normal server and can use python for this purpose but not sure whether it will be able to handle 5K mails/sec so thought to ask first. -- Regards RAKESH KUMAR http://raakeshkumar.wordpress.com
Raakesh kumar <kumar3180@gmail.com> writes:
Dear All, I have to start a project for our internal purpose and that is we have to create a MTA which will take data from our database(like from, to, message etc.) and will transfer/receive it to/from other ISPs (e.g. google mail, yahoo mails). The problem which i think could arise is, our peak time value for sending/receiving mails would be 5K mails/sec. I can develop normal server and can use python for this purpose but not sure whether it will be able to handle 5K mails/sec so thought to ask first.
This sounds interesting. Can you elaborate a little? You say that you will take data from your database and then receive from places like Google mail. How does that work? Sending email can be a simple script that uses smtplib and reads from a database. You can easily scale it by creating multiple instances of this script that operate on pieces of the database. Receiving email means an SMTP server listening on a port. This will be a little more complicated but you can write one using lamson[1]. I don't know about how much email it can handle but if you do very minimal processing in Python before handing it over to a real SMTP server like postfix, it might be able to handle the load. Alternatively, you can simply let a regular smtp server receive email into a local spool file or store them in a way which is then exposed by an IMAP/POP server. Then a tiny python script to read emails out of this and process them would be able to lag behind the high email load. Footnotes: [1] https://github.com/zedshaw/lamson -- Cordially, Noufal http://nibrahim.net.in
[...] On Thu, Nov 8, 2012 at 4:03 PM, Noufal Ibrahim <noufal@gmail.com> wrote:
This sounds interesting. Can you elaborate a little?
You say that you will take data from your database and then receive from places like Google mail. How does that work?
[/...] First of all Thank You Sir. Actually, we have to send mails to so many people like some lacks or so and sometimes concurrently e.g 5-6K per/sec and Gmail generally doesn't provide facility(as much i know). So i thought to develop my own system which can do it. [...]
Sending email can be a simple script that uses smtplib and reads from a database. You can easily scale it by creating multiple instances of this script that operate on pieces of the database.
[/...] Can you please elaborate this? What does that mean by operating in pieces? [...]
Receiving email means an SMTP server listening on a port. This will be a little more complicated but you can write one using lamson[1]. I don't know about how much email it can handle but if you do very minimal processing in Python before handing it over to a real SMTP server like postfix, it might be able to handle the load.
[/...] This has been solved actually now we will not receive mails through it. Now my requirement is just to build a system to send mails in fact bulk mails. AFAIK i can pick data from database and by simple looping it can be sent to others but this huge figure is something scary. Any comment on this? -- Regards RAKESH KUMAR http://raakeshkumar.wordpress.com
[...] On Thu, Nov 8, 2012 at 4:03 PM, Noufal Ibrahim <noufal@gmail.com> wrote:
This sounds interesting. Can you elaborate a little?
You say that you will take data from your database and then receive from places like Google mail. How does that work?
Sending email can be a simple script that uses smtplib and reads from a database. You can easily scale it by creating multiple instances of this script that operate on pieces of the database.
[/...] Actually i simply don't have to write a mail sending script but a specialized MTA in python. I have read that python smtplib uses other MTA like sendmail(correct me if wrong). [...]
Receiving email means an SMTP server listening on a port. This will be a little more complicated but you can write one using lamson[1]. I don't know about how much email it can handle but if you do very minimal processing in Python before handing it over to a real SMTP server like postfix, it might be able to handle the load. Alternatively, you can simply let a regular smtp server receive email into a local spool file or store them in a way which is then exposed by an IMAP/POP server. Then a tiny python script to read emails out of this and process them would be able to lag behind the high email load.
[/...]
I am now not intended to receive mails. Actually i just wrote a python script to send mails using smtp but it was very slow (nearly one mail per sec) but then i switched the code to threading concept and created simultaneous threads to process it but this also didn't help much (and now speed is nealy 4-6 mails/sec). I am very worried whether i can achieve my peak value or not. But spending time on it i realized that its not actually an MTA but a simple python script that uses systems sendmail MTA. Any suggestion on this? -- Regards RAKESH KUMAR http://raakeshkumar.wordpress.com
participants (2)
-
Noufal Ibrahim -
Raakesh kumar