Re: [Tutor] sending email via SMTP: code review requested

2014-05-06 Thread Alan Gauld
On 05/05/14 18:53, Steven D'Aprano wrote: And, as I side note, could anyone explain why changing a first world of a body line 'From' to '>From' is the preferred standard? Because it's a dirty, nasty hack invented by somebody who wasn't thinking very carefully at the time, and now everybody doe

Re: [Tutor] sending email via SMTP: code review requested

2014-05-05 Thread Japhy Bartlett
If you get deeper into processing emails, you might check out http://lamsonproject.org/ . I wasn't fond of the whole thing, but if you dig into the src there is some pretty good code for handling malformed MIME structures and unicode issues in a sane way. On Mon, May 5, 2014 at 4:26 PM, Brian va

Re: [Tutor] sending email via SMTP: code review requested

2014-05-05 Thread Brian van den Broek
On 5 May 2014 13:53, Steven D'Aprano wrote: > On Sun, May 04, 2014 at 07:00:24PM -0400, Brian van den Broek wrote: >> Hi all, >> >> I am playing with the smtp and email modules from the standard library >> of Python 2.7.3 (I also want it to run on 2.6.6). I've not found the >> going easy; the SMTP

Re: [Tutor] sending email via SMTP: code review requested

2014-05-05 Thread Steven D'Aprano
On Sun, May 04, 2014 at 07:00:24PM -0400, Brian van den Broek wrote: > Hi all, > > I am playing with the smtp and email modules from the standard library > of Python 2.7.3 (I also want it to run on 2.6.6). I've not found the > going easy; the SMTP and RFC 2822 standards are not ones I have worked

Re: [Tutor] sending email via SMTP: code review requested

2014-05-05 Thread Japhy Bartlett
The "from" quirk is because it gets parsed as a header, I think. Sending is pretty simple, you should be OK. It may be worth setting up an outgoing-only mail server like postfix that only listens in localhost, gmail can be fussy about quotas. On Sunday, May 4, 2014, Brian van den Broek wrote:

[Tutor] sending email via SMTP: code review requested

2014-05-04 Thread Brian van den Broek
Hi all, I am playing with the smtp and email modules from the standard library of Python 2.7.3 (I also want it to run on 2.6.6). I've not found the going easy; the SMTP and RFC 2822 standards are not ones I have worked with before. I have something that works, but I am not confident I am doing the

Re: [Tutor] sending email via smtplib

2012-11-19 Thread Saad Javed
Using port 25 with SMTP_SSL gives: Traceback (most recent call last): File "sendemail.py", line 22, in smtp = smtplib.SMTP_SSL(smtp_srv, 25) File "/usr/lib/python2.7/smtplib.py", line 776, in __init__ SMTP.__init__(self, host, port, local_hostname, timeout) File "/usr/lib/python2.7/

Re: [Tutor] sending email via smtplib

2012-11-19 Thread Prasad, Ramit
Saad Javed wrote: > > I don't think using SSL works with hotmail. I tried using: > > smtplib.SMTP_SSL("smtp.live.com", 587) You need to use port 25 not 587. http://windows.microsoft.com/en-US/hotmail/send-receive-email-from-mail-client > smtplib.login(user, passwd) > ... > > That gave this er

Re: [Tutor] sending email via smtplib

2012-11-18 Thread Saad Javed
I don't think using SSL works with hotmail. I tried using: smtplib.*SMTP_SSL*("smtp.live.com", 587) smtplib.login(user, passwd) ... That gave this error: Traceback (most recent call last): File "sendemail.py", line 22, in smtp = smtplib.SMTP_SSL(smtp_srv, 587) File "/usr/lib/python2.7/s

Re: [Tutor] sending email via smtplib

2012-11-18 Thread Alexander
On Sun, Nov 18, 2012 at 12:23 AM, Saad Javed wrote: > import smtplib > > from_addr = "some_a...@hotmail.com" > to_addr = "some_a...@gmail.com" > smtp_srv = "smtp.live.com" > > subject = "Test" > message = "Test" > > msg = "To:%s\nFrom:%s\nSubject: %s\n\n%s" % (to_addr, from_addr, subject, > messa

[Tutor] sending email via smtplib

2012-11-17 Thread Saad Javed
import smtplib from_addr = "some_a...@hotmail.com" to_addr = "some_a...@gmail.com" smtp_srv = "smtp.live.com" subject = "Test" message = "Test" msg = "To:%s\nFrom:%s\nSubject: %s\n\n%s" % (to_addr, from_addr, subject, message) smtp = smtplib.SMTP(smtp_srv, 587) smtp.set_debuglevel(1) smtp.ehlo(

Re: [Tutor] Sending Email - Outlook 2003 / Overcome SecurityWarning!

2009-05-10 Thread Alan Gauld
"Alex Feddor" wrote I would like to send email inside my Python code. On PC I have installed Outlook 2003. Outlook is a mail client, you don't need to use it to send email from Python. You can use the email module to do this, or for more detailed access use the smtp module. This just sends

Re: [Tutor] Sending email as html

2008-09-07 Thread Tim Johnson
On Sunday 07 September 2008, you wrote: > On Sun, Sep 7, 2008 at 11:27 AM, Tim Johnson <[EMAIL PROTECTED]> wrote: > > On Saturday 06 September 2008, Alan Gauld wrote: > >> There is an interersting looking link here: > >> > >> http://www.python.org/workshops/2002-02/papers/17/index.htm > > > > Yes!

Re: [Tutor] Sending email as html

2008-09-07 Thread Kent Johnson
On Sun, Sep 7, 2008 at 11:27 AM, Tim Johnson <[EMAIL PROTECTED]> wrote: > On Saturday 06 September 2008, Alan Gauld wrote: >> There is an interersting looking link here: >> >> http://www.python.org/workshops/2002-02/papers/17/index.htm > Yes! Did you find the code to go with the article? My goog

Re: [Tutor] Sending email as html

2008-09-07 Thread Tim Johnson
On Saturday 06 September 2008, Alan Gauld wrote: > "Tim Johnson" <[EMAIL PROTECTED]> wrote > > >> since PDF files are not very hard to edit with a simple text > >> editor. > >> (Never have really.) > > > > Looks like I could make up a PDF template and then put substitutions > > You could although t

Re: [Tutor] Sending email as html

2008-09-06 Thread Alan Gauld
"Tim Johnson" <[EMAIL PROTECTED]> wrote since PDF files are not very hard to edit with a simple text editor. (Never have really.) Looks like I could make up a PDF template and then put substitutions You could although they are not pure text files so you may need to use binary mode to edit th

Re: [Tutor] Sending email as html

2008-09-06 Thread Tim Johnson
On Saturday 06 September 2008, Glen Wheeler wrote: > From: "Alan Gauld" <[EMAIL PROTECTED]> > > > "Lie Ryan" <[EMAIL PROTECTED]> wrote > > > >>> programs which can edit PDFs which has somewhat destroyed > >>> their value as a read-only document format for contracts, invoices > >>> etc... > >> > >>

Re: [Tutor] Sending email as html

2008-09-06 Thread Alan Gauld
"Glen Wheeler" <[EMAIL PROTECTED]> wrote If you have used tried using any PDF editor for more than correcting typos, you'd still consider it as a read-only document. True. but for contracts or invoices just changing a 1 to a 7 or vice versa can make a big difference to the money owed! And

Re: [Tutor] Sending email as html

2008-09-06 Thread Glen Wheeler
From: "Alan Gauld" <[EMAIL PROTECTED]> "Lie Ryan" <[EMAIL PROTECTED]> wrote programs which can edit PDFs which has somewhat destroyed their value as a read-only document format for contracts, invoices etc... If you have used tried using any PDF editor for more than correcting typos, you'd st

Re: [Tutor] Sending email as html

2008-09-06 Thread Alan Gauld
"Lie Ryan" <[EMAIL PROTECTED]> wrote programs which can edit PDFs which has somewhat destroyed their value as a read-only document format for contracts, invoices etc... If you have used tried using any PDF editor for more than correcting typos, you'd still consider it as a read-only document.

Re: [Tutor] Sending email as html

2008-09-05 Thread Lie Ryan
> Message: 3 > Date: Sat, 6 Sep 2008 00:17:43 +0100 > From: "Alan Gauld" <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Sending email as html > To: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; format=flowed; charset=

Re: [Tutor] Sending email as html

2008-09-05 Thread johnf
On Friday 05 September 2008 05:03:30 pm Ted Roche wrote: > On Fri, Sep 5, 2008 at 6:42 PM, Tim Johnson <[EMAIL PROTECTED]> wrote: > > I've been using smtplib for years to send plain text emails > > programmatically. Now I have a customer who is requesting that I (at > > least) investigate sending i

Re: [Tutor] Sending email as html

2008-09-05 Thread Tim Johnson
On Friday 05 September 2008, Kent Johnson wrote: > On Fri, Sep 5, 2008 at 8:30 PM, Tim Johnson <[EMAIL PROTECTED]> wrote: > > On Friday 05 September 2008, Alan Gauld wrote: > > <...> > > > >> The argument to the contrary is simple enough - its not secure and > >> vulnerable to 'virus' type attack.

Re: [Tutor] Sending email as html

2008-09-05 Thread Kent Johnson
On Fri, Sep 5, 2008 at 8:30 PM, Tim Johnson <[EMAIL PROTECTED]> wrote: > On Friday 05 September 2008, Alan Gauld wrote: > <...> >> The argument to the contrary is simple enough - its not secure and >> vulnerable to 'virus' type attack. For that reason many corporate >> firewalls >> trap or even pre

Re: [Tutor] Sending email as html

2008-09-05 Thread Tim Johnson
On Friday 05 September 2008, Tim Johnson wrote: > Sounds like nothing much has changed in 5 years. I did a project like > this in 1993 with another programming language despite my reservations > and had the client sign a "Hold Harmless" doc before I proceeded. Erratum: Should have 2003, not 1993

Re: [Tutor] Sending email as html

2008-09-05 Thread Tim Johnson
On Friday 05 September 2008, Alan Gauld wrote: <...> > The argument to the contrary is simple enough - its not secure and > vulnerable to 'virus' type attack. For that reason many corporate > firewalls > trap or even prevent its delivery. (This is due to the ability to > embed > script tags with V

Re: [Tutor] Sending email as html

2008-09-05 Thread Ted Roche
On Fri, Sep 5, 2008 at 6:42 PM, Tim Johnson <[EMAIL PROTECTED]> wrote: > > I've been using smtplib for years to send plain text emails programmatically. > Now I have a customer who is requesting that I (at least) investigate sending > invoices by email as html. I'm a big fan of sending invoices as

Re: [Tutor] Sending email as html

2008-09-05 Thread Alan Gauld
"Tim Johnson" <[EMAIL PROTECTED]> wrote I would appreciate examples, URLs to documentation or discussions of the topic and even an argument to the contrary of sending email with embedded html. The argument to the contrary is simple enough - its not secure and vulnerable to 'virus' type attack

[Tutor] Sending email as html

2008-09-05 Thread Tim Johnson
Greetings: I've been using smtplib for years to send plain text emails programmatically. Now I have a customer who is requesting that I (at least) investigate sending invoices by email as html. I would appreciate examples, URLs to documentation or discussions of the topic and even an argument t

Re: [Tutor] Sending Email

2007-10-03 Thread Steve Willoughby
On Wed, Oct 03, 2007 at 02:09:07PM -0700, Steve Willoughby wrote: > On Wed, Oct 03, 2007 at 05:02:52PM -0400, Kent Johnson wrote: > > One gotcha is that msg must also include From and Two headers. A > > slightly longer example is here: > > http://docs.python.org/lib/SMTP-example.html > > Yes, tha

Re: [Tutor] Sending Email

2007-10-03 Thread Steve Willoughby
On Wed, Oct 03, 2007 at 05:02:52PM -0400, Kent Johnson wrote: > One gotcha is that msg must also include From and Two headers. A > slightly longer example is here: > http://docs.python.org/lib/SMTP-example.html Yes, that's important to remember. Actually, you want to put all the headers you care

Re: [Tutor] Sending Email

2007-10-03 Thread Kent Johnson
Steve Willoughby wrote: > Python comes with an smtplib module which works very well. You say > you want plain text, so just do this: > > import smtplib > > mail = smtplib.SMTP(mailhost_name) > mail.sendmail(from_addr, to_addr, msg) > mail.quit() One gotcha is that msg must also include From a

Re: [Tutor] Sending Email

2007-10-03 Thread Steve Willoughby
On Wed, Oct 03, 2007 at 04:40:08PM -0400, Paul D. Kraus wrote: > I have a turbogears app that needs to be able to send out email > notifications to users. Just plain text, no attachments. Can anyone > suggest some lightweight module? > > Maybe something Akin to Perl's MIME::Lite. Python comes wit

[Tutor] Sending Email

2007-10-03 Thread Paul D. Kraus
I have a turbogears app that needs to be able to send out email notifications to users. Just plain text, no attachments. Can anyone suggest some lightweight module? Maybe something Akin to Perl's MIME::Lite. Paul ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Sending email from windows python

2006-12-26 Thread Art Hollingsworth
al Message - From: [EMAIL PROTECTED] To: ALAN GAULD <[EMAIL PROTECTED]> Cc: tutor@python.org Sent: Tuesday, December 26, 2006 0:23:08 AM GMT-0700 US/Mountain Subject: Re: [Tutor] Sending email from windows python indigo is paid do u know free windows smtp servers On 12/25/06, ALA

Re: [Tutor] Sending email from windows python

2006-12-26 Thread ALAN GAULD
> How do we run sendmail from windows Searching Google for 'sendmail windows' gave me this: http://www.indigostar.com/sendmail.htm as the first link... > I found Xmail > > http://www.xmailserver.org/ But any smtp server will do just as well. Alan G. > > > how do we use sendmail to send mai

Re: [Tutor] Sending email from windows python

2006-12-25 Thread mobiledreamers
indigo is paid do u know free windows smtp servers On 12/25/06, ALAN GAULD <[EMAIL PROTECTED]> wrote: > How do we run sendmail from windows Searching Google for 'sendmail windows' gave me this: http://www.indigostar.com/sendmail.htm as the first link... > I found Xmail > > http://www.xmai

Re: [Tutor] Sending email from windows python

2006-12-25 Thread mobiledreamers
How do we run sendmail from windows I found Xmail http://www.xmailserver.org/ On 12/25/06, Alan Gauld <[EMAIL PROTECTED]> wrote: > how do we use sendmail to send mail from windows > smtplib works in unix flawlessly It should work in windows too provided you have an SMTP server such as sendm

Re: [Tutor] Sending email from windows python

2006-12-25 Thread Alan Gauld
"anil maran" <[EMAIL PROTECTED]> wrote > how do we use sendmail to send mail from windows > smtplib works in unix flawlessly It should work in windows too provided you have an SMTP server such as sendmail running somewhere. Alan G. ___ Tutor mailli

[Tutor] Sending email from windows python

2006-12-25 Thread anil maran
Hi guys how do we use sendmail to send mail from windows smtplib works in unix flawlessly thanks Anil __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com