473,396 Members | 2,085 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,396 software developers and data experts.

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 1807
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(outgoing-server)
failed = s.sendmail(out_from, to_list , msg)
except smtplib.SMTPRecipientsRefused, x :
do something # for recip in x.recipients: info = x.recipients[recip]
except smtplib.SMTPDataError, x:
do something # x[0], x[1]
except smtplib.SMTPSenderRefused, 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.SMTPRecipientsRefused, 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
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...
3
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...
4
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...
2
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...
11
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...
6
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...
0
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...
0
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...
7
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.