[Tutor] need to automate connection
Kent Johnson
kent37 at tds.net
Tue Apr 25 14:48:37 CEST 2006
Payal Rathod wrote:
> On Tue, Apr 25, 2006 at 06:59:29PM +1200, Liam Clarke wrote:
>> Hi Payal,
>>
>> I see you're connecting to an smtp server Any particular reason yoou
>> can't use smtplib?
>> http://www.python.org/doc/current/lib/module-smtplib.html
>
> Because I don't know it exists :)
>
> But I don't want to send any mail. I just want to establish a connection
> send MAIL TO: and RCPT TO: and exit.
> Any ideas with that? With warm regards,
smtplib.SMTP has a docmd() method. Something like this (not tested so
probably not quite right):
import smtplib
smtp = smtplib.SMTP('127.0.0.1')
print smtp.docmd('mail', 'from: <test at test.com>')
print smtp.docmd('rcpt', 'to: <support at example.com>')
Kent
More information about the Tutor
mailing list