0

I'm writing a program which is sending files through SMTP, thanks to my (local) Postfix server, on port 25.

Is it possible to use several threads (thus several sockets) to inject emails faster ?

Adrien
  • 1
  • Yesterday, I got a 503 error : Nested MAIL command. I'm launching 2 threads which are instantiating smtplib objects. – Adrien Jan 22 '11 at 17:44

1 Answers1

0

Depends entirely on where the bottleneck is. If it's on the SMTP server or the network, the answer is no. If it's in your python code, probably yes.

Jim Garrison
  • 85,615
  • 20
  • 155
  • 190
  • The postfix queue is around 1/2 messages continuously, and I would like to boost it to be filled by more messages. – Adrien Jan 13 '11 at 22:21
  • That queue size just tells you Postfix is keeping up with the incoming rate, but says nothing about how many messages per second it is processing. Are you doing load testing? – Jim Garrison Jan 13 '11 at 22:32
  • I did one. Actually, a thread is sending files from a folder "A". I can instantiate several dozen of threads, and in that case, I would like to handle several connections... to the same Postfix server. – Adrien Jan 13 '11 at 22:39
  • If my port 25 is taken by 2 threads, my program is throwing exception ; and if I acquire/release locks, it's not faster than the single threaded version. – Adrien Jan 14 '11 at 05:00
  • You don't use port 25 on your system. Port 25 is the listening port on the SMTP server, the one you connect to. When you open a connection, you use any available port on your system. – Jim Garrison Jan 14 '11 at 17:27
  • That's exactly what I thought, but I don't understand why my both python threads are looking as if they were using the same (local) port... I'm keeping diging ! – Adrien Jan 18 '11 at 18:21
  • Edit your post and add some of your Python code showing how you're opening the connection – Jim Garrison Jan 18 '11 at 20:03