Jul-18-2018, 12:48 PM
I tried using the example code as below:
it run ok but when I check the mail ([email protected]), I don't receive any email. :(
Could you please help me this problem?
Thanks all very much.
Quote:smtp_senddata.py
import smtplib import email.utils from email.mime.text import MIMEText # Create the message msg = MIMEText('This is the body of the message.') msg['To'] = email.utils.formataddr(('Recipient', '[email protected]')) msg['From'] = email.utils.formataddr(('Author', '[email protected]')) msg['Subject'] = 'Simple test message' server = smtplib.SMTP('127.0.0.1', 1025) server.set_debuglevel(True) # show communication with the server try: server.sendmail('[email protected]',['[email protected]'],msg.as_string()) finally: server.quit()
Quote:smtpd_custom/.py
import smtpd import asyncore class CustomSMTPServer(smtpd.SMTPServer): def process_message(self, peer, mailfrom, rcpttos, data): print 'Receiving message from:', peer print 'Message addressed from:', mailfrom print 'Message addressed to :', rcpttos print 'Message length :', len(data) return server = CustomSMTPServer(('127.0.0.1', 1025), None) asyncore.loop()I run stmpd_custom.py then smtpd_senddata.py.
it run ok but when I check the mail ([email protected]), I don't receive any email. :(
Could you please help me this problem?
Thanks all very much.