EzDevInfo.com

lamson

Pythonic SMTP Application Server lamsonproject.org - This website is for sale! - lamsonproject Resources and Information. this website is for sale! lamsonproject.org is your first and best source for all of the information you’re looking for. from general topics to more of what you would expect to find here, lamsonproject.org has it all. we hope you find what you are searching for!

How do I setup Lamson to use DKIM signatures?

I would like to use Lamson (lamsonproject.org) to use DKIM signing but I cannot find any information about this in their documentation or generally online.

Could someone suggest a starting point please?


Source: (StackOverflow)

launch lamson as a process

Can i programmatically launch the lamson SMTP server from inside my python code?

it cam be launched from the command line as:

lamson start

but , i want to lauch it from code using the multiprocess packege

from multiprocessing import Process

   def f(name):
      # what to put here

if __name__ == '__main__':
   p = Process(target=f, args=('bob',))
   p.start()
   p.join()

what to put in the f function to lauch a lamson server

How this can be achieved?

thanks


Source: (StackOverflow)

Advertisements

Can Lamson run under TLS/SSL and authenticate users?

I can't find anything about users authenticating themselves before being able to send mail to Lamson. The only SSL/TLS mention I found is in Relay class, which I understand runs after Lamson finishes processing the message. I want Lamson to check LDAP credentials before it does any processing, but I don't want passwords sent over the network unencrypted. I can handle the LDAP part provided there are auth handlers of some sort, which I also didn't find.

I haven't written any code yet, just exploring options by reading docs for now.


Source: (StackOverflow)

Lamson for clojure?

Are there any java or clojure mail libraries out there that do what lamson does? In particular, the mail routing features of lamson are very cool http://verpa.wordpress.com/2010/11/13/making-your-webapp-react-to-emails-with-lamson-pt-2/ are there any thing like that for the jvm?


Source: (StackOverflow)

Hooking up lamson with django 1.4

I'm trying to hook-up lamson with django 1.4. I've seen the documentation on hooking up lamson with django and the librelist example from the source, but it seems to use a previous version of django.

I have created a "webapp" project that contains an "emails" app as described in the basic django 1.4 tutorial.

The webapp/webapp/settings.py file contains a reference to the emails application in the installed_apps like this:

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    # 'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
    'emails',
)

The lamson application folder contains the webapp folder for the django project. Now, instead of having a "webapp/emails" folder that contains everything like in the librelist example provided by Zed Shaw, i have yet another webapp folder that contains the settings.py, plus the extra application folder (emails) that contains the models and all (this is due to the new directory structure in django 1.4).

In the config/settings.py file for lamson, I have added the following line:

os.environ['DJANGO_SETTINGS_MODULE'] = 'webapp.webapp.settings'

Now, in the my handler code, (app/handlers/my_handler.py), i have imported my models:

import webapp.emails.models

I can create instances from my model correctly, but as soon as i try to save them to the database using my_instance.save(), I get the following error:

File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
ImportError: No module named emails

Any idea what the problem can be?

Otherwise, is it possible to remove django 1.4 and use django 1.3 to make it work?

Thanks for your help


Source: (StackOverflow)

Why lamson and sendmail can listen to port 25 the same time?

I started sendmail at port 25. Then started lamson (another SMTP server) at port 25. They both worked. Why they can listen to the same port?


Source: (StackOverflow)

Sending mail with python - how to set Return-Path that is different from 'From' address

What im trying to do is to set up smail mail server with lamson (lamsonproject.org). Its working very well, but i have problem with setting return path and for that reason, bounces are going to 'From' address and therefore not reaching my mail server.

Lamson uses pythons smtplib to send mails out.

The "talk" between my project and my smtp server goes like that:

send: 'ehlo xxx.mydomiain.com\r\n'
reply: '250-smtp.smtpserver.com\r\n'
reply: '250-PIPELINING\r\n'
reply: '250-SIZE 20000000\r\n'
reply: '250-VRFY\r\n'
reply: '250-ETRN\r\n'
reply: '250-STARTTLS\r\n'
reply: '250-XVERP\r\n'
reply: '250 8BITMIME\r\n'
reply: retcode (250); Msg: smtp.smtpserver.com
PIPELINING
SIZE 20000000
VRFY
ETRN
STARTTLS
XVERP
8BITMIME
send: u'mail FROM:<me@myotherdomain.com> size=352\r\n'
reply: '250 Ok\r\n'
reply: retcode (250); Msg: Ok
send: u'rcpt TO:<pleasebouncethis@myotherdomain.com>\r\n'
reply: '250 Ok\r\n'
reply: retcode (250); Msg: Ok
send: 'data\r\n'
reply: '354 End data with <CR><LF>.<CR><LF>\r\n'
reply: retcode (354); Msg: End data with <CR><LF>.<CR><LF>
data: (354, 'End data with <CR><LF>.<CR><LF>')
send: 'MIME-Version: 1.0\r\nTo: pleasebouncethis@myotherdomain.com\r\nSubject: Testing bounces\r\nSender: MAILER-DAEMON@mydomiain.com\r\nReturn-Path: MAILER-DAEMON@mydomain.com\r\nReply-To: MAILER-DAEMON@mydomain.com\r\nMessage-Id: 377b8dcdf661810d3dc73a4a01fe23b3\r\nFrom: me@myotherdomain.com\r\nContent-Type: text/plain; charset="utf-8"\r\nContent-Transfer-Encoding: base64\r\n\r\nc2RmZ2TDpGfDpGRsZsOkZ2xkZmc=\r\n.\r\n'
reply: '250 Ok: queued as E635D157D3\r\n'
reply: retcode (250); Msg: Ok: queued as E635D157D3
data: (250, 'Ok: queued as E635D157D3')
send: 'quit\r\n'
reply: '221 Bye\r\n'
reply: retcode (221); Msg: Bye
Done

so i can see, that the Return-Path is indeed in headers.

While looking for an answer i found this : Setting Return-Path with Python sendmail for a MIME message

Last comment in the answer is: Errors/bounces/etc. should go to the Envelope sender, not the address in From:.

When looking up Envelope sender and how to specify, i came across this wiki article: http://en.wikipedia.org/wiki/Bounce_address

This lists another possible header parameters like: return path, reverse path, envelope from, envelope sender, MAIL FROM, 2821-FROM, return address, From_, Errors-to.

I put all those into mail headers and - Voila - It worked.

My question is now - Do i really have to ALWAYS list so many possible options for return path in mail headers? Have the mail servers been configured to accept one or two of those parameters now? Are there better ways to make sure, that mail is returned to my mail server, when it bounces?

Alan.


Source: (StackOverflow)

How to set mails undeliverable in Lamson handlers?

Lamson puts mails into undeliverable queue if no handler matches. However, I can't do this matching entirely using regex for the route decorator, because I need to validate the address using information from, for instance, a database. Thus, I need to be able to put mail with invalid address into the undeliverable queue from the handler. How can I do this?

My handler looks something like:

@route("(address)@(host)", address=".+", host="example\.com")
@stateless
def START(message, address=None, host=None):

    # Here is a complex validation of the address.
    # It uses, for instance, information from a database.
    # If the address is valid, mail is sent and the function returns

    # The code ends up here if the address wasn't valid.
    # How can I put the mail into the undelivarable queue?

Source: (StackOverflow)

Lamson for multiple Django projects

I'd like to know how to use Django and Lamson together in such a way that Lamson can utilize several Django projects.

I have several Django websites running on my server (e.g., domain1.com, domain2.com and domain3.com). I'm using virtual hosts for each website. Each Django project uses its own virtual environment, thus enabling them to use different versions of Django (and possibly even Python).

I'd like to use Lamson to do simple email handling: forward the email to correct recipients. For instance, list1@domain1.com have some subscribers and the Django project corresponding to domain1.com has that information. Or firstname.lastname@domain2.com could be an alias for a real address which is known by the Django project domain2.com. Typically, the information is not in the database as such directly, but one needs to perform some kind of project specific logic. For instance, men@domain1.com would filter only male user accounts and then return their email addresses as a list.

There are some instructions on how to combine Django and Lamson so that Lamson can access the database of a Django project easily. However, I have only found solutions for the case when there is only one Django project AND Lamson&Django use the same/similar (virtual) environment. That kind of solution is described, for instance, here, but I don't think it can be applied here.

So, how can Lamson communicate with several Django projects in order to translate an email address to a list of real email addresses?


Source: (StackOverflow)

Lamson (Python SMTP Server) Error

I've installed Lamson via easy_install on my webfaction shared hosting. Went to do the '30 Second Introduction' (See http://lamsonproject.org/docs/getting_started.html) but after:

[almacmillan@web129 python2.6]$ lamson gen -project mymailserver

I get:

    Traceback (most recent call last):
  File "/home/almacmillan/bin/lamson", line 5, in <module>
    pkg_resources.run_script('lamson==1.0', 'lamson')
  File "/usr/local/lib/python2.6/site-packages/pkg_resources.py", line 448, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/local/lib/python2.6/site-packages/pkg_resources.py", line 1166, in run_script
    execfile(script_filename, namespace, namespace)
  File "/home/almacmillan/lib/python2.6/lamson-1.0-py2.6.egg/EGG-INFO/scripts/lamson", line 3, in <module>
    from lamson import args, commands
  File "/home/almacmillan/lib/python2.6/lamson-1.0-py2.6.egg/lamson/commands.py", line 28, in <module>
    from lamson import server, args, utils, mail, routing, queue, encoding
  File "/home/almacmillan/lib/python2.6/lamson-1.0-py2.6.egg/lamson/utils.py", line 12, in <module>
    from daemon import pidlockfile
  File "/home/almacmillan/lib/python2.6/python_daemon-1.5.5-py2.6.egg/daemon/pidlockfile.py", line 33, in <module>
    class PIDLockFile(LinkFileLock, object):
TypeError: Error when calling the metaclass bases
    function() argument 1 must be code, not str

I'm a very new programmer. I'd really appreciate some debugging help.


Source: (StackOverflow)

Process dynamic email addresses using python

I need to do the following and I was wondering if anyone has done something similar, and if so what they did.

I need to write a program that will handle incoming emails for different clients, process them, and then depending on the email address, do something (add to database, reply, etc).

The thing that makes this a little more challenging is that the email addresses aren't static they are dynamic. For example. The emails would be something like this. dynamic-email1@dynamic-subdomain1.domain.com . The emails are grouped by client using a dynamic subdomain in this example it would be 'dynamic-subdomain1'. A client would have their own subdomain that is assigned to them. Each client can create their own email address under their subdomain, and assign an event to that email. These email addresses and subdomains can change all of the time, new ones added, old ones removed, etc.

So for example if an email comes in for the email 'dynamic-email1@dynamic-subdomain1.domain.com' then I would need to look up in the database to find out which client is assigned the 'dynamic-subdomain1' subdomain and then look to see which event maps to the email address of 'dynamic-email1' and then execute that event. I have the event processing already, I'm just not sure how to map the email addresses to the event.

Since the email addresses are dynamic, it would be a real pain to handle this with file based configuration files, it would be nice to look up in a database instead. I did some research and I found some projects that do something similar but not exactly. The closest that I found is Zed Shaw's Lamson project: http://lamsonproject.org

More background:

  • I'm using python, django, linux, mysql, memcached currently.

Questions:

  1. Has anyone used Lamson to do what I'm looking to do, how did you like it?
  2. Is there any other projects that do something similar, maybe in a different language besides python?
  3. How would I setup my DNS MX record to handle something like this?

Thanks for your help.

Update: I did some more research on the google app engine suggestion and it might work but I would need to change too many things and it would add too many moving parts. I would also need a catch all emailer forwarder, anyone know of any good cheap ones? I prefer to deploy on system that handles all email. It looks like people have used postfix listening on port 25 and forwarding requests to lamson. This seems reasonable, I'm going to try it out and see how it goes. I'll update with my results.

Update 2: I did some more research and I found a couple of websites that do something like this for me, so I'm going to look at them next.

http://mailgun.net

http://www.emailyak.com


Source: (StackOverflow)

Lamsonproject - how to test the changes in the core?

I'm extending the core of lamson server because I need it. What I need is to test it whether I've do it right or wrong by sending the SMTP and ESTMP commands to it such as HELO, EHLO and others and retrieving a reply from it. It's hosted on localhost. In the documentation it doesn't say how to do that and I can't figure out how to do it.

Any pointers?


Source: (StackOverflow)

lamson: mail address format

I'm using Lamson SMTP server with a Queue receiver for a project. It works fine, but from time to time, I get weird address emails in the "to" and "cc" headers from the email sent with mutt, with the default testing environment.

ex. an email sent to

test@test.com

with mutt will be sent to the SMTPReceiver, placed in maildir and processed with the QueueReceiver. What I finally get is something like

test@xn--est-o0a.com

I'm guessing it has to do with encoding but since Lamson is supposed to provide clean unicode strings...i don't know.

Any thought?

Thanks.


Source: (StackOverflow)