Re: How to send E-mail without an external SMTP server ?



Rob Wolfe wrote:
fdu.xiaojf@xxxxxxxxx wrote:
Hi,

I just want to send a very simple email from within python.

I think the standard module of smtpd in python can do this, but I
haven't found documents about how to use it after googleing. Are there
any examples of using smtpd ? I'm not an expert,so I need some examples
to learn how to use it.

See standard documentation:

http://docs.python.org/lib/SMTP-example.html

HTH,
Rob


I have read the example and copied the code and save as send.py, then I run it. Here is the output:
$ python send.py
From: fdu.xiaojf@xxxxxxxxx
To: fdu.xiaojf@xxxxxxxxx
Enter message, end with ^D (Unix) or ^Z (Windows):
just a test from localhost
Message length is 82
send: 'ehlo [202.127.19.74]\r\n'
reply: '250-WebMail\r\n'
reply: '250 AUTH plain\r\n'
reply: retcode (250); Msg: WebMail
AUTH plain
send: 'mail FROM:<fdu.xiaojf@xxxxxxxxx>\r\n'
reply: '502 negative vibes\r\n'
reply: retcode (502); Msg: negative vibes
send: 'rset\r\n'
reply: '502 negative vibes\r\n'
reply: retcode (502); Msg: negative vibes
Traceback (most recent call last):
File "send.py", line 26, in ?
server.sendmail(fromaddr, toaddrs, msg)
File "/usr/lib/python2.4/smtplib.py", line 680, in sendmail
raise SMTPSenderRefused(code, resp, from_addr)
smtplib.SMTPSenderRefused: (502, 'negative vibes', 'fdu.xiaojf@xxxxxxxxx')


Do I have to setup a smtp server on my localhost ?

Thanks a lot.

xiaojf

.



Relevant Pages

  • Re: smtpd module
    ... I dont know how to use smtpd, ... > server with python, for some tests that I need to run that just prints ... > smtpd module seems to provide this ability via the DebuggingServer. ... Douglas Soares de Andrade ...
    (comp.lang.python)
  • Re: How to send E-mail without an external SMTP server ?
    ... I think the standard module of smtpd in python can do this, ... use an external mail server. ...
    (comp.lang.python)
  • How to send E-mail without an external SMTP server ?
    ... I think the standard module of smtpd in python can do this, but I haven't found documents about how to use it after googleing. ...
    (comp.lang.python)
  • Re: How to send E-mail without an external SMTP server ?
    ... I think the standard module of smtpd in python can do this, ... See standard documentation: ...
    (comp.lang.python)
  • Re: py3k s***s
    ... have broken my old code for no good reason. ... your code, blame you and python, and move on to use something else. ... support for the old regex module as a standard module which simply ... of/forgot reconvert, but it doesn't ...
    (comp.lang.python)