473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

"Mail receiver server"

In an intranet/lan, i'd like to put a "python server script" (which run
forever) on a computer A...

On another computer B, I'd like to send smtp-email to the computer A ...
(send to "us**@126.52.12.12", for example ...126.52.12.12 is the ip
address of "B")

in fact, i'd like to control "computer A" by sending smtp email from
"computer B".

What kind of server should i write on computer "B", a smtp server ? a
pop server ?
(i think i have to make a script which listen on a port, and execute
some handlers ... but i don't know how to start)

i know python very well, but i dont know anything about smtp/lan
if you have a recipe to build this kind of server, it could be good
but i'm pretty sure it can be easy to do ...
Jul 18 '05 #1
4 2577
On Mon, 31 Jan 2005 23:23:46 +0100, manatlan <ma*****************@free.fr>
wrote:
in fact, i'd like to control "computer A" by sending smtp email from
"computer B".

What kind of server should i write on computer "B", a smtp server ? a
pop server ?


It would be easier if you used an existing mail server (which OS are you
running on comp B?), then use its redirecting features to pipe the
incoming mail to your python script. AFAIK most servers support that. Less
hassle, though probably a wee bit more intensive for the computer.
Jul 18 '05 #2
Mitja a écrit :
On Mon, 31 Jan 2005 23:23:46 +0100, manatlan
<ma*****************@free.fr> wrote:
in fact, i'd like to control "computer A" by sending smtp email from
"computer B".

What kind of server should i write on computer "B", a smtp server ? a
pop server ?

It would be easier if you used an existing mail server (which OS are
you running on comp B?), then use its redirecting features to pipe the
incoming mail to your python script. AFAIK most servers support that.
Less hassle, though probably a wee bit more intensive for the computer.


the OS is a win32 (w2k), with IIS ... there is a "Virtual SMTP server"
in IIS ...

I like the idea, but how to connect the virtual smtp and a python script ?

but ... There should be a way to be python only ... because i don't want
to be very complex, i just want to get the subject of the email, to run
some commands (and perhaps get a attachment file) ... but that's all
i am pretty sure that a recipe exists ... that a man has already done that !
But i don't know what to query on google ...
Jul 18 '05 #3
manatlan said the following on 1/31/2005 5:46 PM:

I like the idea, but how to connect the virtual smtp and a python script ?

but ... There should be a way to be python only ... because i don't want
to be very complex, i just want to get the subject of the email, to run
some commands (and perhaps get a attachment file) ... but that's all
i am pretty sure that a recipe exists ... that a man has already done
that !
But i don't know what to query on google ...


Hi,

What you are trying to do is what is called a mail filter. So google for
python mail filter and see what you get.

With this setup, lets say Computer B sends an email to user controluser
on Computer A , the email is actually passed off to a script (in your
case python script) to process the incoming email, instead of actually
delivering the email to the user's inbox on "A".

I don't have the faintest the idea how you would do this on IIS's
virtual SMTP server; there is probably a setup user panel. In any case,
on UNIXish systems, there are a few ways of doing it of which one way is
to setup a user in a file called /etc/aliases and put an entry like this:

controluser: | /usr/local/bin/mailprocessor.py

which tells the SMTP server to pass off the email to script after the |
(pipe) when controluser gets an email.

So, see if the SMTP control panel provides you with some such feature.
If IIS does not, my suggestion to you will be to install Cygwin from
cygwin.com and use the Exim Mail transfer agent available with Cygwin
(You will have to choose that when installing Cygwin, it is not
automatically installed) or please google for Windows SMTP Server and
see if something piques your interest.

Now, coming to the Python related part. Your SMTP server will invoke
your script by sending the incoming email data on your script's sysin.

So, from python you will do...

#!/usr/local/bin/python
import sys, email, os

em = email.message_from_file(sys.stdin) # Read message from Std Input
subject = em.get('Subject') # Get the subject from em object
if subject.startswith('reboot'):
os.system('shutdown -r') # reboot the Server

For more information, please read the email module in the Python Module
Docs.

Hope that will help you get started!

Thanks,
--Kartic
Jul 18 '05 #4
Kartic a écrit :
manatlan said the following on 1/31/2005 5:46 PM:

I like the idea, but how to connect the virtual smtp and a python
script ?

but ... There should be a way to be python only ... because i don't
want to be very complex, i just want to get the subject of the email,
to run some commands (and perhaps get a attachment file) ... but
that's all
i am pretty sure that a recipe exists ... that a man has already done
that !
But i don't know what to query on google ...

Hi,

What you are trying to do is what is called a mail filter. So google for
python mail filter and see what you get.

With this setup, lets say Computer B sends an email to user controluser
on Computer A , the email is actually passed off to a script (in your
case python script) to process the incoming email, instead of actually
delivering the email to the user's inbox on "A".

I don't have the faintest the idea how you would do this on IIS's
virtual SMTP server; there is probably a setup user panel. In any case,
on UNIXish systems, there are a few ways of doing it of which one way is
to setup a user in a file called /etc/aliases and put an entry like this:

controluser: | /usr/local/bin/mailprocessor.py

which tells the SMTP server to pass off the email to script after the |
(pipe) when controluser gets an email.

So, see if the SMTP control panel provides you with some such feature.
If IIS does not, my suggestion to you will be to install Cygwin from
cygwin.com and use the Exim Mail transfer agent available with Cygwin
(You will have to choose that when installing Cygwin, it is not
automatically installed) or please google for Windows SMTP Server and
see if something piques your interest.

Now, coming to the Python related part. Your SMTP server will invoke
your script by sending the incoming email data on your script's sysin.

So, from python you will do...

#!/usr/local/bin/python
import sys, email, os

em = email.message_from_file(sys.stdin) # Read message from Std Input
subject = em.get('Subject') # Get the subject from em object
if subject.startswith('reboot'):
os.system('shutdown -r') # reboot the Server

For more information, please read the email module in the Python Module
Docs.

Hope that will help you get started!

Thanks,
--Kartic


thanx a lot for yours informations ...
it was very interesting ...

in fact, i've already built a "smtp filter" with the virtual smtp server
of iis ... (3 years ago)
But with techno of microsoft ... with event sink and vbs ...
and i think there is no way to do it with python ...
it could be possible to do it again with dot.net ...

but i've found what i wanted here :
http://www-106.ibm.com/developerwork...ws-pyth12.html

it seems it could be possible to build its own smtpd with python ... and
interact in a simple way ...

i will choose this solution ... i'm fed up with microsoft way
and could be reused on my linux box too ;-)

i will have a look ...
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: HoustonComputerGuy | last post by:
I am working on getting my web applications moved to .Net 2.0 and am having some problems with System.Net.Mail. I get the following error when sending the mail: System.Net.Mail.SmtpException was...
6
by: Kurda Yon | last post by:
Hi everybody, I have a problem with the function "mail". It returns "true" but supposed recipients receive nothing. My code is as follows: $to = $form; $subject = "E-mail Verification";...
3
by: Jason Huang | last post by:
Hi, In my C# Windows form project, I can receieve the mail from the C# code, however, it's EMPTY in the MAIL FROM: Would someone give me some advice? string Data; byte szData; TcpClient...
0
by: yunusb2k | last post by:
Dear All, plese help me , i using ASPMAIL script for sending mail for my webiste but from last 2 month my script not working properl;y and send mail to only same host domain like i have 2 site...
2
by: shil | last post by:
Hi all, I'm using System.Net.Mail (Framework 2.0) to send emails on scheduled basis. This works great on Windows 2000 server. Rently we have upgraded our servers to Windows 2003. Since then some...
1
by: vps | last post by:
I have Apache 2.2 server running on Windows XP SP2 with PHP 5.2.5. I have run go-pear.bat in PHP directory (system-wide, all defaults). Running “pear” command lists additional commands. I...
1
by: =?Utf-8?B?VGFsYWxTYWxlZW0=?= | last post by:
i have facility in my website which sends an e-mail to the cleint's inbox..... i am getting a problem when ever i sends an e-mail.. i tried with Hotmail and Yahoo, e-mail goes to the "Junk Mail"...
0
by: Danigan | last post by:
Is there a way I can set up Apache to put incoming emails into a folder as individual text files (MIME, text, or I guess it'd be cool if Apache has a module to throw it into a database like mySQL...
3
by: Evan | last post by:
Hello - I'm new with Python, I try to do a mail problem, the code likes below: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ import smtplib import mimetypes from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.