By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,532 Members | 1,514 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,532 IT Pros & Developers. It's quick & easy.

Python for email?

P: n/a
Is there a good module for sending out email?

For a website that I am working on, I am writing a program that finds out
which presenters have not yet confirmed their scheduled date and sends them
an email to confirm.

Does python have any modules for use with mail programs like sendmail, or
should I just run everything with os.system and os.popen?

Thanks for any help.
Jul 18 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
On Fri, 26 Mar 2004 17:16:29 -0800, sean wrote:
Is there a good module for sending out email?

For a website that I am working on, I am writing a program that finds out
which presenters have not yet confirmed their scheduled date and sends them
an email to confirm.

Does python have any modules for use with mail programs like sendmail, or
should I just run everything with os.system and os.popen?

Thanks for any help.


Check out smtplib, it should do what you want

Good Luck,
Brett

Jul 18 '05 #2

P: n/a

sean> Is there a good module for sending out email?

Check out smtplib in the standard library:

http://www.python.org/doc/current/li...e-smtplib.html

Skip

Jul 18 '05 #3

P: n/a
In article <ma************************************@python.org >,
Skip Montanaro <sk**@pobox.com> wrote:

sean> Is there a good module for sending out email?

Check out smtplib in the standard library:

http://www.python.org/doc/current/li...e-smtplib.html

Skip


'Past time that I mention this: I'm a big fan of the smtplib module.
In general, I think this is the direction Python-oriented developers
should take, and NOT to "shell out" to sendmail or such. However,
one benefit of sendmail and comparable MTAs that's often not immedi-
ately apparent (and, with any luck, won't be for the life of any
specific project) is their knowledge about retries. Projects that
face erratic connectivity either need to exploit an installed MTA,
or program their own retry management.

smtplib presents a few other, even more marginal issues. If an
installed MTA enforces institutional standards (disclaimers, archi-
ving, ...), smtplib is likely to subvert those. Decide for yourself
if that's a good or bad thing.
--

Cameron Laird <cl****@phaseit.net>
Business: http://www.Phaseit.net
Jul 18 '05 #4

P: n/a
cl****@lairds.com (Cameron Laird) writes:
smtplib presents a few other, even more marginal issues. If an
installed MTA enforces institutional standards (disclaimers, archi-
ving, ...), smtplib is likely to subvert those.


How so?

The example for smtplib given here
http://www.python.org/doc/current/lib/SMTP-example.html
appears to relay mail through "localhost". That will typically be
equivalent to using the "installed MTA", right?

--kyler
Jul 18 '05 #5

P: n/a
In article <mq************@snout.lairds.org>,
Kyler Laird <Ky***@news.Lairds.org> wrote:
cl****@lairds.com (Cameron Laird) writes:
smtplib presents a few other, even more marginal issues. If an
installed MTA enforces institutional standards (disclaimers, archi-
ving, ...), smtplib is likely to subvert those.


How so?

The example for smtplib given here
http://www.python.org/doc/current/lib/SMTP-example.html
appears to relay mail through "localhost". That will typically be
equivalent to using the "installed MTA", right?

--kyler


All true, and by neglecting to read the manual recently, I've
confused things. Thanks for the correction.

*I* have the habit of doing something that I now see the smtplib
documentation does not recommend--'fact, I now suspect that it
never did, and that it's my own memory that introduced all the
problems. Here's what I should have written before:
smtplib is great. If you get in the habit of using
it to connect directly to the far endpoint, as I do,
you risk the surprise of finding situations where a
local MTA is an advantage. In any case, though,
smtplib can always be configured do at least as much
for you as shelling out to a local mailer.
--

Cameron Laird <cl****@phaseit.net>
Business: http://www.Phaseit.net
Jul 18 '05 #6

P: n/a
"sean" <se********@cox.net> wrote in message news:<SB49c.47641$Bg.20541@fed1read03>...
Is there a good module for sending out email?

For a website that I am working on, I am writing a program that finds out
which presenters have not yet confirmed their scheduled date and sends them
an email to confirm.

Does python have any modules for use with mail programs like sendmail, or
should I just run everything with os.system and os.popen?

Thanks for any help.


.... and using imaplib, you could *listen* to an email account for
confirmations and thus, know if the confirm info as reached the
presenters brain !-)

jean-marc
Spring is in the air
Jul 18 '05 #7

P: n/a
Thanks you all for the info. That is exacly what I was looking for.
"jmdeschamps" <jm*********@cvm.qc.ca> wrote in message
news:3d**************************@posting.google.c om...
"sean" <se********@cox.net> wrote in message

news:<SB49c.47641$Bg.20541@fed1read03>...
Is there a good module for sending out email?

For a website that I am working on, I am writing a program that finds out which presenters have not yet confirmed their scheduled date and sends them an email to confirm.

Does python have any modules for use with mail programs like sendmail, or should I just run everything with os.system and os.popen?

Thanks for any help.


... and using imaplib, you could *listen* to an email account for
confirmations and thus, know if the confirm info as reached the
presenters brain !-)

jean-marc
Spring is in the air

Jul 18 '05 #8

P: n/a
Quoth cl****@lairds.com (Cameron Laird):
| ... Here's what I should have written before:
| smtplib is great. If you get in the habit of using
| it to connect directly to the far endpoint, as I do,
| you risk the surprise of finding situations where a
| local MTA is an advantage. In any case, though,
| smtplib can always be configured do at least as much
| for you as shelling out to a local mailer.

Of course there's no guarantee that a connection to localhost
is going to work, either - not all hosts accept incoming mail.
But it probably isn't a great idea to try to send it right to
the recipient's doorstep, especially if you're not prepared to
look up DNS MX records.

Some sites provide a host just for this purpose, for use by
desktop mail software and other similar applications.

Donn Cave, do**@drizzle.com
Jul 18 '05 #9

P: n/a
cl****@lairds.com (Cameron Laird) writes:
However, one benefit of sendmail and comparable MTAs that's often
not immedi- ately apparent (and, with any luck, won't be for the
life of any specific project) is their knowledge about retries.


A good argument against MTAs when doing an application for deployment
with less than knowledgable sysadmins that pick a default linux box
and do an install just to get your system up on running on their
intranet.

When their email doesn't work for one of a myriad of reasons (FQDN,
relay configuration, odd internal MX records) you're left supporting
them or telling them to find support for some piece of software more
complex than what you probably gave them.

I got reminded of this yet again when I tried to do a VERY quick
install of bugzilla a few months ago.

Getting them to enter an IP and then on the phone telling them to do
telnet host 25 is a much easier thing to debug.
--
Chris Green <cm*@dok.org>
A good pun is its own reword.
Jul 18 '05 #10

P: n/a
Hi all,

I have a very primitive question about Python & COM interface.
As of now I have not got any good documentation on using it.
I am planning to buy Python programming on win32 book.
[ It will reach me only after 2 days :-( ]

Could some one please suggest how to add one COM interface which takes
int array as input.
precisely I want to do following

a=[]
a.append(100)
a.append(200)

from win32com.client import Dispatch
o=Dispatch("MyAppl.com")
o.setIntArray(len(a),a)
I am expecting in my COM interface, I will get VARIENT of SAFEARRAY .

in ATL com implementation,
SAFEARRAY *array=V_ARRAY(a);
long i,val;
for(i=0;i<len;i++){
SafeArrayGetElement(array,&i,&val)
c_array[i]= val;
}

I am not getting proper values in C array.
Any suggestions?

Regards,
Anand

Jul 18 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.