The Little Guy Posted May 30, 2010 Share Posted May 30, 2010 Is there any way to make a mail server in python? Quote Link to comment https://forums.phpfreaks.com/topic/203384-python-mail-server/ Share on other sites More sharing options...
Mchl Posted May 30, 2010 Share Posted May 30, 2010 http://www.google.pl/search?q=python+mail+server Quote Link to comment https://forums.phpfreaks.com/topic/203384-python-mail-server/#findComment-1065479 Share on other sites More sharing options...
The Little Guy Posted June 1, 2010 Author Share Posted June 1, 2010 I have already looked through that, and can't find what I am looking for. Quote Link to comment https://forums.phpfreaks.com/topic/203384-python-mail-server/#findComment-1066268 Share on other sites More sharing options...
Mchl Posted June 1, 2010 Share Posted June 1, 2010 But it should answer your question. Since there apparently ARE mail servers written in python, it IS possible to do it. Quote Link to comment https://forums.phpfreaks.com/topic/203384-python-mail-server/#findComment-1066291 Share on other sites More sharing options...
The Little Guy Posted June 1, 2010 Author Share Posted June 1, 2010 oh haha, I guess it did answer my question do you (or anyone else) know where I can find info on sending/recieving mail with python without having to use an external mail server? Quote Link to comment https://forums.phpfreaks.com/topic/203384-python-mail-server/#findComment-1066326 Share on other sites More sharing options...
Daniel0 Posted June 1, 2010 Share Posted June 1, 2010 http://www.faqs.org/rfcs/rfc821.html Quote Link to comment https://forums.phpfreaks.com/topic/203384-python-mail-server/#findComment-1066342 Share on other sites More sharing options...
The Little Guy Posted June 2, 2010 Author Share Posted June 2, 2010 Server: 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(('localhost', 1025), None) asyncore.loop() I have the above, I think it works, but it doesn't send the message to my gmail account. Am I missing something? Client: 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', 'ryannaddy@phpsnips.com')) msg['From'] = email.utils.formataddr(('Author', 'author@example.com')) 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('author@example.com', ['ryannaddy@phpsnips.com'], msg.as_string()) finally: server.quit() Quote Link to comment https://forums.phpfreaks.com/topic/203384-python-mail-server/#findComment-1066497 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.