How to send a mail using bottlepy

287 views
Skip to first unread message

James

unread,
Nov 27, 2012, 9:52:38 AM11/27/12
to bott...@googlegroups.com
If I can't, any module made for python 3 where I can send mails with?

Iuri

unread,
Nov 27, 2012, 10:12:58 AM11/27/12
to bott...@googlegroups.com
You can use smtplib module.


It is not related with bottle, it is a built-in Python module. This is the default way to send emails in Python.

cheers,
iurisilvio


On Tue, Nov 27, 2012 at 12:52 PM, James <aegy...@yahoo.com> wrote:
If I can't, any module made for python 3 where I can send mails with?

--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

James

unread,
Nov 27, 2012, 2:01:00 PM11/27/12
to bott...@googlegroups.com
How do I download it?

On Tuesday, 27 November 2012 16:52:38 UTC +2 James wrote:
If I can not, any module made for? Python 3 where I can send mails with

Iuri

unread,
Nov 27, 2012, 2:06:10 PM11/27/12
to bott...@googlegroups.com
You don't. =)

If you have Python 3 installed, it is already there.

import smtplib
server = smtplib.SMTP('localhost')
server.sendmail('fr...@example.com', ['t...@example.com'], 'Your email message.')
server.quit()

You can get better examples in Python docs.




--

KH

unread,
Nov 27, 2012, 2:19:33 PM11/27/12
to bott...@googlegroups.com
Either the smtplib module or alternatively e.g. Marrow Mailer (https://github.com/marrow/marrow.mailer).

"Marrow Mailer is a Python library to ease sending emails from your application.
...
Mailer supports Python 2.6+ and 3.1+ and there are only light-weight dependencies: marrow.utilmarrow.interface, and botoif using Amazon SES."

James

unread,
Nov 27, 2012, 2:30:27 PM11/27/12
to bott...@googlegroups.com
smtplib makes an error when I make this code:
server = smtplib.SMTP('localhost')
Error:
socket.error: [Errno 10061] No connection could be made because the target machine actively refused it

Ian Epperson

unread,
Nov 27, 2012, 6:26:12 PM11/27/12
to bott...@googlegroups.com
James,

This it outside of Bottlepy and off topic for this list.  Just like any email client, to send email you need a server to handle the mail for you.  Because of spammers, very few support relaying mail without a valid user account login.  The 'localhost' make the assumption that you have a local mail server running on the machine that will handle the delivery.   If you have a server that you use, check out the setup you'll need for an SMTP client.


Check out the smtplib documentation for examples on how to handle authentication:  http://docs.python.org/3/library/smtplib.html

Again, this is not an issue with Bottle.

Ian E.


--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.



--
This email is intended for the use of the individual addressee(s) named above and may contain information that is confidential, privileged or unsuitable for overly sensitive persons with low self-esteem, no sense of humor or irrational religious beliefs. If you are not the intended recipient, any dissemination, distribution or copying of this email is not authorized (either explicitly or implicitly) and constitutes an irritating social faux pas. Unless the word absquatulation has been used in its correct context somewhere other than in this warning, it does not have any legal or grammatical use and may be ignored. No animals were harmed in the transmission of this email, although the yorkshire terrier next door is living on borrowed time, let me tell you. Those of you with an overwhelming fear of the unknown will be gratified to learn that there is no hidden message revealed by reading this warning backwards, so just ignore that Alert Notice from Microsoft: However, by pouring a complete circle of salt around yourself and your computer you can ensure that no harm befalls you and your pets. If you have received this email in error, please add some nutmeg and egg whites and place it in a warm oven for 40 minutes. Whisk briefly and let it stand for 2 hours before icing.

James

unread,
Nov 28, 2012, 12:11:20 PM11/28/12
to bott...@googlegroups.com
Ok, then how do I make sure that the one who registered didn't use someone else's email?


Am Dienstag, 27. November 2012 16:52:38 UTC+2 schrieb James:
Reply all
Reply to author
Forward
0 new messages