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?
-- www.wintergreen.in 12 2794
On 20/09/05, Chris Dewin <no************@all.com> 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 :)
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
On 20/09/05, Daniel Dittmar <da************@sap.corp> 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.
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
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
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
>>>>> Steve Holden <st***@holdenweb.com> (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 <pi**@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: pi**@vanoostrum.org
Peter Hansen <pe***@engcorp.com> 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.
<mike
--
Mike Meyer <mw*@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
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
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
On Tue, 20 Sep 2005 16:48:41 +0200, rumours say that Piet van Oostrum
<pi**@cs.uu.nl> 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 pi**@example.com, and your private mail is pi**@yagoohoogle.com; if you send email through your office mail server
with the envelope "MAIL FROM: pi**@yagoohoogle.com\n", 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
On Wed, 21 Sep 2005 07:50:26 +0100, rumours say that Steve Holden
<st***@holdenweb.com> 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Garry Hodgson |
last post by:
how do i use smtplib to send mail to someone with "cc" to someone else?
if i just include the "to" addressees in the call to smtplib.sendmail(), and
put the others in the "Cc" header fields, only...
|
by: Frank Zheng |
last post by:
I wrote some code to test "smtplib", but i met a problem when i call the
"login(user,pass)" of the "SMTP" object.
here are the codes:
>>> s = smtplib.SMTP()
>>> s.set_debuglevel(1)
>>>...
|
by: mark.greenbank |
last post by:
Hi,
I'm writing a small script that generates email and I've noticed that:
1) one should add the 'To' and 'CC' headers to the email message
2) one needs to specify the recipients in the...
|
by: Matthias Kluwe |
last post by:
Hi!
After getting a @gmail.com address, I recognized I had to use TLS in my
python scripts using smtplib in order to get mail to the smtp.gmail.com
server.
Things work well so far, apart from...
|
by: Van_Gogh |
last post by:
Hi,
I am learning how to use the smtplib module, but am having some very
early problems, maybe because I don't understand it.
So, am I correct that by following the example in the Python:
>>>...
|
by: Roger |
last post by:
I am having a problem sending email through smtp.gmail.com using
smtplib. Everything works and the mail is sent and received, except
quit. The following shows the problem (without bothering to...
|
by: ornto |
last post by:
Hi, I'm trying to create an application which checks a
dynamic web site and on certain events sends an email to me.
My problem though is with the email task. By now I made this
simple test code:
...
|
by: Hunter |
last post by:
I am writing a script that needs to send some emails. And I've used
smtplib in the past and it is pretty easy. But I thought, gee it
would be easier if I could just call it as a function, passing...
|
by: yoma |
last post by:
hi guys!
I want to use python send an email to acceptor. $B!!(BAnd i hope to
receive the message that the acceptor has read my email.
So how to realize that get the message?
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
| | |