473,950 Members | 20,913 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

very small python smtpish send

Anyone know of a small Python script that acts as a slimmed down smtp
server (just sends from the local machine)? I currently use a smtp
server for sending email reports from machines, but as machines travel
outside of our lan, the smtp server refuses to relay their messages. So,
I thought it would be better if each machine had its own little mail
sender this way, it could continue reporting no matter where it was located.

These are all Windows machines... is there a Windows equivalent to
'stdin | mail -s "Subject" em***@email.com' that comes on most Unix
machines?
Jul 18 '05 #1
2 1841
On Fri, 8 Oct 2004, Brad Tilley wrote:
Anyone know of a small Python script that acts as a slimmed down smtp
server (just sends from the local machine)? I currently use a smtp
server for sending email reports from machines, but as machines travel
outside of our lan, the smtp server refuses to relay their messages. So,
I thought it would be better if each machine had its own little mail
sender this way, it could continue reporting no matter where it was located.
It is not good to send mail from anywhere because direct smtp from
arbitrary IPs are often considered spamish. Consider setting up
secure smtp server which will receive authenticated mail from any
corporate client on special port.
These are all Windows machines... is there a Windows equivalent to
'stdin | mail -s "Subject" em***@email.com' that comes on most Unix
machines?


Sincerely yours, Roman Suzi
--
rn*@onego.ru =\= My AI powered by GNU/Linux RedHat 7.3
Jul 18 '05 #2
On Fri, 8 Oct 2004, Brad Tilley wrote:

Anyone know of a small Python script that acts as a slimmed down smtp
server (just sends from the local machine)? I currently use a smtp
server for sending email reports from machines, but as machines travel
outside of our lan, the smtp server refuses to relay their messages.
OK, so the clients are sending email to addresses that are not local to
your lan's server (otherwise there would be no relaying attempt)

Have you considered turning on authentication on the lan server, you can
then allow relaying only from an authenticated "client".
I thought it would be better if each machine had its own little mail
sender this way, it could continue reporting no matter where it was

located.

Sending directly from the client to the recipient address's server is
valid, doesn't need authentication, and relatively simple to do using
smtplib.py . However, nowadays this may be problematic because of
increasing anti-spam measures that *might* cause the email to be refused on
a variety of criteria (IP address (RBL) , IP address reverse lookup,
possibly SPF, etc etc ).

import smtplib
try:
s = smtplib.SMTP(ou tgoing-server)
failed = s.sendmail(out_ from, to_list , msg)
except smtplib.SMTPRec ipientsRefused, x :
do something # for recip in x.recipients: info = x.recipients[recip]
except smtplib.SMTPDat aError, x:
do something # x[0], x[1]
except smtplib.SMTPSen derRefused, x :
do something # x.sender, x.smtp_code, x.smtp_error
except:
do something

(failed contains a list of failed recipients if *some* but not all failed,
if all failed then use
except smtplib.SMTPRec ipientsRefused, x :)

Alternatively there are some free mail SPs out there that provide
authenticated outgoing servers that you could use if you can't turn on
authentication on your lan server.
Jul 18 '05 #3

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

Similar topics

2
1621
by: Peter Kleiweg | last post by:
This is weird... Running small Python scripts, now and again a window dump is created, and saved as the module name without the extension. This happens on Linux. The dumped file is a PostScript file with the image of one Window that was active at the moment (completely unrelated to the Python application), and has a header comment that says it was created by ImageMagick. Magic, indeed. The file has the somewhat unusual access bits...
3
1637
by: Sizer | last post by:
We make embedded devices that are basically wimpy linux boxes with small custom display/touchscreen heads on them. They're not running X or any other windowing system. All development is done with C++ and PEG (Portable Embedded GUI) driving the display. PEG lets you install your own hardware driver to talk any custom hardware, which is what we've done. Currently we have an upgrade/installer application that boots from CD, reads an XML...
4
2214
by: DJTB | last post by:
Hi, I'm trying to manually parse a dataset stored in a file. The data should be converted into Python objects. Here is an example of a single line of a (small) dataset: 3 13 17 19 -626177023 -1688330994 -834622062 -409108332 297174549 955187488 589884464 -1547848504 857311165 585616830 -749910209 194940864 -1102778558 -1282985276 -1220931512 792256075 -340699912 1496177106 1760327384
2
17430
by: jfixsen | last post by:
Hello! Oracle 9.2.0.4 SunOS pchi-db01 5.8 Generic_108528-19 sun4u sparc SUNW,Ultra-EnterpriseSystem = SunOS Node = pchi-db01 Release = 5.8 KernelID = Generic_108528-19 Machine = sun4u BusType = <unknown>
11
1419
by: yoda | last post by:
It was 2a.m.... I was writing my first enterprise scale application in Python.... the logic just flowed from my mind onto the keyboard and was congealed into the most beautiful terse lines of code I had ever seen... It was 3a.m.... I knew I had to sleep.... work the next day or rather, in a few hours.... but Python somehow brought out all the logic. All the verbosity of my thought was purified into clean beautiful logic... The Python...
6
2522
by: peter_k | last post by:
Hi, Last time i'm interested in optimizing small c programs. On my studies we are sending the programs using the web interface to online judge. The person who will wrote the faster program get the bonus score. This are usually simple problems, like sorting small numbers, parsing the text and checking something etc... To get the bonus the good algorithm is not everything, you have to do a lot of optimizations on c level (or asembler...
0
1509
by: ycollet | last post by:
Hello, I'm trying to write a program to send python statements to a python server via tcp and then get back results via a tcp connection. It nearly works ... but I'm totally lost with the embedded dictionary (I'm quite new to python). The first part of the server start the python interpreter via Py_Initialize() and then waits for python statements. To send command, I get some strings and evaluate them through PyRun_String.
0
216
by: M.-A. Lemburg | last post by:
On 2008-07-31 02:29, python@bdurham.com wrote: If you don't have a problem with taking a small performance hit, then I'd suggest to have a look at mxBeeBase, which is an on-disk dictionary implementation: http://www.egenix.com/products/python/mxBase/mxBeeBase/ Of course, you could also use a database table for this. Together with a proper index that should work as well (but it's likely slower
7
1950
by: Marin Brkic | last post by:
Not commercial distribution, but an academic kind of sorts - giving the exe file to coleagues, so they can use it in their work. Giving ..py file is not an option, since due to centralized computer maintenance, they don't (and cannot) have installed python (except the ones that bring their own computer at work, but those are an exception). As far as I know py2exe is the only option which can do such a thing (make exe files from...
0
10171
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11600
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11191
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11369
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10703
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9904
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8268
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6233
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.