Mailing List Archive

Help: sendmail under MS NT
Under unix platforms, using, for example,

sendmail_cmd = "/usr/lib/sendmail -oi "

to access the SMTP sendmail utility.

Our enquery is: under Windows NT/95/98 platforms,
how to access the "sendmail" utility from within
python code?

Thanks,

Shicheng






Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Help: sendmail under MS NT [ In reply to ]
Being new to Python, someone else may be able to give you a more
efficient way to do this or maybe a real sendmail command. But, using
smtplib.py I found that I had to initialize mailserver with a valid mail
server and mail recipient for it to work. I also imported cgi, urllib,
os, and my_mailtomessages which shouldn't be needed for this snippet.
This is running Python and Netscape Enterprise Server on an intel NT box
with the form data coming from an ALPHA NT box.


------------------
import smtplib
import string

# Get form data up here or any other code you may need

# HERE BEGINS THE MAILTO Defaults PORTION OF THE SCRIPT

mailserver="my.mailserver.appstate.edu"
mailrecip="me@my.mailserver.appstate.edu"
subject="ERROR"

# Asign MAILTO results from form to mailto values
# first get user's domain from email address and use their server to
mail from


mailserver=form["sentfrom"].value[string.find(form["sentfrom"].value,"@")+1:]
mailrecip=form["sendto"].value
subject=form["subject"].value
sender=form["sentfrom"].value
message=form["message"].value

# send the mail
mail=smtplib.SMTP(mailserver)
mail.sendmail(sender,mailrecip,message)
mail.quit

--------------------

This has not been tested with a server outside of my Domain but has
worked with different accounts on different mail servers in this domain.

Thomas

Shicheng wrote:
>
> Under unix platforms, using, for example,
>
> sendmail_cmd = "/usr/lib/sendmail -oi "
>
> to access the SMTP sendmail utility.
>
> Our enquery is: under Windows NT/95/98 platforms,
> how to access the "sendmail" utility from within
> python code?
>
> Thanks,
>
> Shicheng
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

--
----------------------------------------------------------------------
Thomas McMillan Grant Bennett Appalachian State University
Computer Consultant II University Library
bennettt@am.appstate.edu
http://www.library.appstate.edu/admin/
Voice: 828 262 6587 FAX: 828 262 3001

Windows 95 is a 32-bit extension to a 16-bit patch for an 8-bit
operating system that was originally coded for a 4-bit microprocessor.
- Chris Dunphy Boot Magazine
Help: sendmail under MS NT [ In reply to ]
On Fri, 13 Aug 1999 18:55:11 GMT, Shicheng <S.Tian@shu.ac.uk> declaimed
the following in comp.lang.python:

> Under unix platforms, using, for example,
>
> sendmail_cmd = "/usr/lib/sendmail -oi "
>
> to access the SMTP sendmail utility.
>
> Our enquery is: under Windows NT/95/98 platforms,
> how to access the "sendmail" utility from within
> python code?
>
I don't think there is a "sendmail" utility.

This being M$, I expect the answer is that you are supposed to
use OLE/COM/Automation features to submit the message via MAPI to
Outlook, and Outlook will then be responsible for further processing.

I do not use Outlook for email, so such a solution would not
function for me. My SPAM bounce filter (manually invoked from EudoraPro)
builds fully formed bounce messages, and uses the following two lines to
submit the messages back to Eudora. Eudora does have MAPI capabilities
but I don't use those either.



EudoraPath = "F:\Eudora\Eudora.exe"
<intervening snipped>
os.system(EudoraPath + " " + sys.argv[1] + ".msg")


--
> ============================================================== <
> wlfraed@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> wulfraed@dm.net | Bestiaria Support Staff <
> ============================================================== <
> Bestiaria Home Page: http://www.beastie.dm.net/ <
> Home Page: http://www.dm.net/~wulfraed/ <
Help: sendmail under MS NT [ In reply to ]
Check the topic indexes at C/C++ User's Journal and Dr. Dobb's Journal web
sites. Sometime between mid 1996 and early 1998, there was an article
featuring a sendmail DLL for Win32, which hid the messy internals of MAPI
and left you with something basically as simple as sendmail. It would be a
trivial matter to encapsulate this and the Unix sendmail in a portable
least-common-denominator wrapper.
Help: sendmail under MS NT [ In reply to ]
In article <XM8t3.62641$jl.39581340@newscontent-01.sprint.ca>,
Bruce Dodson <bruce_dodson@bigfoot.com> wrote:
>Check the topic indexes at C/C++ User's Journal and Dr. Dobb's Journal web
>sites. Sometime between mid 1996 and early 1998, there was an article
>featuring a sendmail DLL for Win32, which hid the messy internals of MAPI
>and left you with something basically as simple as sendmail. It would be a
>trivial matter to encapsulate this and the Unix sendmail in a portable
>least-common-denominator wrapper.
>

It's often even easier than this. While the original
questioner asked about the "sendmail utility on NT"
(which *is* available, by the way, at a price), I
speculate it's likely he'd been happy simply pointing
a very simple network client toward the nearest open-
to-his-application SMTP relay.
--

Cameron Laird http://starbase.neosoft.com/~claird/home.html
claird@NeoSoft.com +1 281 996 8546 FAX