Re: Sending mail from 'current user' in Python

2005-06-14 Thread Leo Breebaart
Marcus Alanen <[EMAIL PROTECTED]> writes: > >>I've also tried opening a pipe to sendmail, and feeding the > >>message to that instead. This too works great [but] doesn't > >>seem like much of an improvement, portability-wise. > > No, but at least it can be expected to do the right thing > w.r.t. s

Re: Sending mail from 'current user' in Python

2005-06-12 Thread Mike Meyer
Marcus Alanen <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >>>Finally, if at all possible I'd also like to get this working on >>>Windows, so I'd rather stick with the standard smtplib if I can. >> smtplib needs an SMTP server to connect to. For unix systems, this is >> typically localhost. What

Re: Sending mail from 'current user' in Python

2005-06-12 Thread Marcus Alanen
Mike Meyer wrote: > BTW, an alternative for the username is the USER environment > variable. I don't know whether or not it exists on Windows. Or LOGNAME. Don't about windows, though. >>I've also tried opening a pipe to sendmail, and feeding the >>message to that instead. This too works great (an

Re: Sending mail from 'current user' in Python

2005-06-11 Thread Grig Gheorghiu
There may have been a reason for the win32 stuff at some pointbut I don't remember and you're right, it does seem like getpass by itself would do the job. Grig -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending mail from 'current user' in Python

2005-06-11 Thread Irmen de Jong
Grig Gheorghiu wrote: > I use this function as a platform-independent way of finding out the > current user name: > > def get_username(): > if sys.platform == 'win32': > return win32api.GetUserName() > else: > return getpass.getuser() > [e:\]python Python 2.4.1 (#65, Mar

Re: Sending mail from 'current user' in Python

2005-06-10 Thread Grig Gheorghiu
I use this function as a platform-independent way of finding out the current user name: def get_username(): if sys.platform == 'win32': return win32api.GetUserName() else: return getpass.getuser() -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending mail from 'current user' in Python

2005-06-10 Thread Matt
Mike Meyer wrote: > Leo Breebaart <[EMAIL PROTECTED]> writes: > > > I can get the username info (at least on Unix) via the 'pwd' > > module, but that still leaves me with the domainname, or rather > > the mailname, and I have not been able to spot a way of finding > > that from within Python. (I

Re: Sending mail from 'current user' in Python

2005-06-10 Thread Mike Meyer
Leo Breebaart <[EMAIL PROTECTED]> writes: > I can get the username info (at least on Unix) via the 'pwd' > module, but that still leaves me with the domainname, or rather > the mailname, and I have not been able to spot a way of finding > that from within Python. (I could try opening /etc/mailname