Re: Question about smtplib, and mail servers in general.

2005-09-26 Thread Christos Georgiou
On Wed, 21 Sep 2005 07:50:26 +0100, rumours say that Steve Holden
<[EMAIL PROTECTED]> might have written:

>I agree that there's an element of the moral imperative in my assertion 
>that the mails "should" go through which is largely ignored by the real 
>world nowadays. Some ISPs force you to use their SMTP servers no matter 
>what the sending domain, which is rather annoying when you travel a lot. 
>I end up having to vary my default SMTP server as I move.

...or set up your email client to always connect to localhost ports eg
31025 and 31110, and then from wherever you are, you connect to an SSH
server trusted by your "standard" mail server and port-forward to it.

Don't know if this applies to your case, but it works for me :)
-- 
Christos Georgiou, Customer Support Engineer
Silicon Solutions, Medicon Ltd.
Melitonos 5, Gerakas 153 44 Greece
Tel +30 21 06606195 Fax +30 21 06606599 Mob +30 693 6606195
"Dave always exaggerated." --HAL
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about smtplib, and mail servers in general.

2005-09-26 Thread Christos Georgiou
On Tue, 20 Sep 2005 16:48:41 +0200, rumours say that Piet van Oostrum
<[EMAIL PROTECTED]> might have written:

>And most smtp servers that I know also pass mail from any from-address to
>any to-address if the IP number of he client machine belongs to a trusted
>range (usually the range that belongs to the ISP). So I can send both my
>private mail and my work mail from both my home ISP's smtp server and my
>work's smtp server (but only if I am at the proper location).

You might start having troubles, though, as soon as SPF checks get more
widespread.

Say your work mail is [EMAIL PROTECTED], and your private mail is
[EMAIL PROTECTED]; if you send email through your office mail server
with the envelope "MAIL FROM: [EMAIL PROTECTED]", then some (and
eventually many) receiving servers shall ask yagoohoogle.com for their
SPF record, and since your office mail server won't probably show up as
a valid email sender from yagoohoogle.com , your email will get
rejected.

That's a good thing.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about smtplib, and mail servers in general.

2005-09-20 Thread Steve Holden
Peter Hansen wrote:
> Steve Holden wrote:
> 
>>Peter Hansen wrote:
>>
>>>In any case, unless the mail server will allow "relaying", which most 
>>>don't these days (to prevent spamming), then it won't work the way you 
>>>are hoping unless *all* the 100 addresses are local ones, to be 
>>>delivered to users on the server you are sending the mail to.
>>>
>>>If the addresses are scattered all over the planet, and the server 
>>>allows relaying, then it's intended for exactly this sort of use 
>>>(other than if it's spam ;-) ), and no, you won't be putting a "drain" 
>>>on the server.
>>
>>To add one final note, if the "fromaddress" belongs to a domain that's 
>>properly handled by the SMTP server then you aren't relaying (since you 
>>are a legitimate domain user) so the mails should go through.
> 
> 
> I think that statement might not be widely valid any more, Steve.  In my 
> experience, lately, many if not most servers pay no attention to the 
> "MAIL FROM" address but instead allow relaying only from *IP addresses* 
> on the "internal" network (e.g. those served by an ISP, for example), 
> regardless of how the sender is identified.  On a Linux box with Qmail, 
> for example, one would have an /etc/tcp.smtp file which specifies for 
> which subnets relaying is allowed, and all others are disallowed 
> regardless of the claimed MAIL FROM address.
> 
> It's kind of a shame, really, that you can no longer trust either the 
> recipient *or* the sender addresses when using basic SMTP.  Damn spammers.
> 
I agree that there's an element of the moral imperative in my assertion 
that the mails "should" go through which is largely ignored by the real 
world nowadays. Some ISPs force you to use their SMTP servers no matter 
what the sending domain, which is rather annoying when you travel a lot. 
I end up having to vary my default SMTP server as I move.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.pycon.org

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about smtplib, and mail servers in general.

2005-09-20 Thread Peter Hansen
Steve Holden wrote:
> Peter Hansen wrote:
>> In any case, unless the mail server will allow "relaying", which most 
>> don't these days (to prevent spamming), then it won't work the way you 
>> are hoping unless *all* the 100 addresses are local ones, to be 
>> delivered to users on the server you are sending the mail to.
>>
>> If the addresses are scattered all over the planet, and the server 
>> allows relaying, then it's intended for exactly this sort of use 
>> (other than if it's spam ;-) ), and no, you won't be putting a "drain" 
>> on the server.
> 
> To add one final note, if the "fromaddress" belongs to a domain that's 
> properly handled by the SMTP server then you aren't relaying (since you 
> are a legitimate domain user) so the mails should go through.

I think that statement might not be widely valid any more, Steve.  In my 
experience, lately, many if not most servers pay no attention to the 
"MAIL FROM" address but instead allow relaying only from *IP addresses* 
on the "internal" network (e.g. those served by an ISP, for example), 
regardless of how the sender is identified.  On a Linux box with Qmail, 
for example, one would have an /etc/tcp.smtp file which specifies for 
which subnets relaying is allowed, and all others are disallowed 
regardless of the claimed MAIL FROM address.

It's kind of a shame, really, that you can no longer trust either the 
recipient *or* the sender addresses when using basic SMTP.  Damn spammers.

-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about smtplib, and mail servers in general.

2005-09-20 Thread Mike Meyer
Peter Hansen <[EMAIL PROTECTED]> writes:
> Daniel Dittmar wrote:
>> Chris Dewin wrote:
>>> Hi. I've been thinking about using smtplib to run a mailing list
>>> from my website.
>>>
>>> s = smtplib.SMTP("server")
>>> s.sendmail(fromaddress, toaddresess, msg)
>>>
>>> I know that in this instance, the toaddresses variable can be a variable
>>> of type list.
>>>
>>> Suppose the list contains well over 100 emails. Would that create some
>>> sort of drain on the mail server? Would I be better off doing it in some
>>> other way?
>> Not really an answer to your question, but it's probably considered
>> bad style to publish the email addresses of the recipients via the
>> address list. Use a neutral To-address (best: the mailing list
>> address) and add the recipients via bcc: headers.
>
> Not only not an answer, but also not a valid point in this case.  The
> list of recipients used in the sendmail() call (which become RCPT TO:
> commands in SMTP) do *not* show up in the received emails.

Not quite. The email address each letter is actually delivered to
generally shows up in one or more Received: headers in the received
email. Some MTAs will add a header (qmail adds Delivered-To:, for
instance) with that same address in it when they deliver the mail
locally. Most MUAs don't display those, but they are there.  There may
be an MTA that will pass a single message along to multiple recipients
after adding all of them to one or more headers. I don't know that
such exist - but I wouldn't trust that they don't.

Since you shouldn't trust email to be secure in any case, this isn't a
big deal. Note that using Bcc: doesn't help with this issue - the
addresses a message is delivered to *have* to be in the envelope. Bcc
puts them there and not in the headers.

http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about smtplib, and mail servers in general.

2005-09-20 Thread Piet van Oostrum
> Steve Holden <[EMAIL PROTECTED]> (SH) wrote:

>SH> To add one final note, if the "fromaddress" belongs to a domain that's
>SH> properly handled by the SMTP server then you aren't relaying (since you are
>SH> a legitimate domain user) so the mails should go through.

And most smtp servers that I know also pass mail from any from-address to
any to-address if the IP number of he client machine belongs to a trusted
range (usually the range that belongs to the ISP). So I can send both my
private mail and my work mail from both my home ISP's smtp server and my
work's smtp server (but only if I am at the proper location).
-- 
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about smtplib, and mail servers in general.

2005-09-20 Thread Steve Holden
Peter Hansen wrote:
> Chris Dewin wrote:
> 
>>Hi. I've been thinking about using smtplib to run a mailing list from my 
>>website.
>>
>>s = smtplib.SMTP("server")
>>s.sendmail(fromaddress, toaddresess, msg)
>>
>>I know that in this instance, the toaddresses variable can be a variable
>>of type list.
>>
>>Suppose the list contains well over 100 emails. Would that create some
>>sort of drain on the mail server? Would I be better off doing it in some
>>other way? 
> 
> 
> Definitely consider a proper mailing list program like Mailman, as 
> Daniel suggested.
> 
> In any case, unless the mail server will allow "relaying", which most 
> don't these days (to prevent spamming), then it won't work the way you 
> are hoping unless *all* the 100 addresses are local ones, to be 
> delivered to users on the server you are sending the mail to.
> 
> If the addresses are scattered all over the planet, and the server 
> allows relaying, then it's intended for exactly this sort of use (other 
> than if it's spam ;-) ), and no, you won't be putting a "drain" on the 
> server.
> 
> -Peter
To add one final note, if the "fromaddress" belongs to a domain that's 
properly handled by the SMTP server then you aren't relaying (since you 
are a legitimate domain user) so the mails should go through.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.pycon.org

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about smtplib, and mail servers in general.

2005-09-20 Thread Peter Hansen
Chris Dewin wrote:
> Hi. I've been thinking about using smtplib to run a mailing list from my 
> website.
> 
> s = smtplib.SMTP("server")
> s.sendmail(fromaddress, toaddresess, msg)
> 
> I know that in this instance, the toaddresses variable can be a variable
> of type list.
> 
> Suppose the list contains well over 100 emails. Would that create some
> sort of drain on the mail server? Would I be better off doing it in some
> other way? 

Definitely consider a proper mailing list program like Mailman, as 
Daniel suggested.

In any case, unless the mail server will allow "relaying", which most 
don't these days (to prevent spamming), then it won't work the way you 
are hoping unless *all* the 100 addresses are local ones, to be 
delivered to users on the server you are sending the mail to.

If the addresses are scattered all over the planet, and the server 
allows relaying, then it's intended for exactly this sort of use (other 
than if it's spam ;-) ), and no, you won't be putting a "drain" on the 
server.

-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about smtplib, and mail servers in general.

2005-09-20 Thread Peter Hansen
Daniel Dittmar wrote:
> Chris Dewin wrote:
> 
>> Hi. I've been thinking about using smtplib to run a mailing list from 
>> my website.
>>
>> s = smtplib.SMTP("server")
>> s.sendmail(fromaddress, toaddresess, msg)
>>
>> I know that in this instance, the toaddresses variable can be a variable
>> of type list.
>>
>> Suppose the list contains well over 100 emails. Would that create some
>> sort of drain on the mail server? Would I be better off doing it in some
>> other way?
> 
> Not really an answer to your question, but it's probably considered bad 
> style to publish the email addresses of the recipients via the address 
> list. Use a neutral To-address (best: the mailing list address) and add 
> the recipients via bcc: headers.

Not only not an answer, but also not a valid point in this case.  The 
list of recipients used in the sendmail() call (which become RCPT TO: 
commands in SMTP) do *not* show up in the received emails.  Only those 
items explicitly listed in the headers, such as the To: header, will 
appear.  In fact, you could easily make a Bcc: header which actually 
lists everyone and it would probably not even be stripped by most mail 
programs (though I haven't tried that).  Your confusion is caused by not 
distinguishing between mail client programs and a lower level utility 
such as smtplib, which doesn't even look at the To: addresses in the header.

-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about smtplib, and mail servers in general.

2005-09-20 Thread Tim Williams (gmail)
On 20/09/05, Daniel Dittmar <[EMAIL PROTECTED]> wrote:
> Chris Dewin wrote:
> > Hi. I've been thinking about using smtplib to run a mailing list from my 
> > website.
> >
> > s = smtplib.SMTP("server")
> > s.sendmail(fromaddress, toaddresess, msg)

> >
> 
> Not really an answer to your question, but it's probably considered bad
> style to publish the email addresses of the recipients via the address
> list. Use a neutral To-address (best: the mailing list address) and add
> the recipients via bcc: headers.
> 

For clarity

The toaddreses don't show in the email,  they are the envelope TO:
addreses.   The addresses in the email's TO: Headers are shown to the
recipient and these are the ones that should be "disguised" as best
practice for mailing lists.

The email module's replace_header('to', 'new-text) will do the job for you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about smtplib, and mail servers in general.

2005-09-20 Thread Daniel Dittmar
Chris Dewin wrote:
> Hi. I've been thinking about using smtplib to run a mailing list from my 
> website.
> 
> s = smtplib.SMTP("server")
> s.sendmail(fromaddress, toaddresess, msg)
> 
> I know that in this instance, the toaddresses variable can be a variable
> of type list.
> 
> Suppose the list contains well over 100 emails. Would that create some
> sort of drain on the mail server? Would I be better off doing it in some
> other way? 
> 

Not really an answer to your question, but it's probably considered bad 
style to publish the email addresses of the recipients via the address 
list. Use a neutral To-address (best: the mailing list address) and add 
the recipients via bcc: headers.

You might also want to look at mailman 
http://www.gnu.org/software/mailman/, which is a complete mailing list 
solution written in Python.

Daniel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about smtplib, and mail servers in general.

2005-09-20 Thread Tim Williams (gmail)
On 20/09/05, Chris Dewin <[EMAIL PROTECTED]> wrote:
> 
> s = smtplib.SMTP("server")
> s.sendmail(fromaddress, toaddresess, msg)
> 
> I know that in this instance, the toaddresses variable can be a variable
> of type list.
> 
> Suppose the list contains well over 100 emails. Would that create some
> sort of drain on the mail server? Would I be better off doing it in some
> other way?

 
> Suppose the list contains well over 100 emails

You mean the list of recipients (toaddresses) ?  

The 2 lines of example code send a *single* email to "server" with
len(toaddresses) recipients.  The server will then split the email
into smaller (or individual) email groups to send (depending on the
server in use and the mechanisms it uses to relay  the email)

You could send a single email for each recipient to "server"

> s = smtplib.SMTP("server")
>for addr in toaddresses:
>  s.sendmail(fromaddress,[addr], msg)
# in later revisions, [addr] can be a list,  or a string of one address

but that would create much more load on your machine AND server

HTH :)
-- 
http://mail.python.org/mailman/listinfo/python-list