[Tutor] Sending mail
anand.shashwat at gmail.com
Fri Mar 26 14:47:56 CET 2010
I guess you can use smtplib.
On Fri, Mar 26, 2010 at 7:07 PM, Timo <timomlists at gmail.com> wrote:
> 2010/3/25 Timo <timomlists at gmail.com>
>> I was wondering what the best way is to send an email through my program?
>> I want the user to send an email with an attachment.
>> I do have a webspace, should I use the smtplib module if my webhost
>> supports it (I have to ask though), or should I put a script on my space and
>> communicate with that?
> I worked on the following code. It works, but not for attachments.
> On the webserver I have: http://python.pastebin.com/9m8MXxuR
> And inside my program I then do:
> form = urllib.urlencode([("from", send_from), ("to", send_to), ("subject",
> subject), ("body", body), ("attachment", attachment)])
> webbrowser.open(url + "?" + form)
> So, 2 questions:
> - Is this a good way of sending mails over my webhost through my program?
> - Attachments don't work because I'm sending the path to the file, and
> ofcourse the cgi script can't find it. How should I solve this?
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor