Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't deliver mails to all recipients #29

Open
b0nd opened this issue Nov 4, 2013 · 4 comments
Open

Doesn't deliver mails to all recipients #29

b0nd opened this issue Nov 4, 2013 · 4 comments

Comments

@b0nd
Copy link

b0nd commented Nov 4, 2013

Following is the setup I've got:

  1. lamson installed inside python virtualenv on ubuntu server
  2. lamson receiver configured to listen on TCP port 25
  3. exim4 configured on same server to listen on TCP port 2500 for relay
  4. lamson relays i.e. passes on mails it receives to exim

Issue:

  1. When put multiple recipients in 'To', lamson sends as many mails as the number of recipients to first recipient only and nothing goes to rest of them
  2. When put 1 recipient in 'To' and rest in 'cc', lamson sends as many mails as the number of recipients to recipient listed in 'To'; nothing goes to rest of recipients.
@b0nd
Copy link
Author

b0nd commented Nov 5, 2013

Infact it's not respecting 'cc' and 'bcc'. Wondering am I at mistake or anybody else hasn't noticed it yet?

Cheers!

@tino
Copy link
Contributor

tino commented Nov 5, 2013

Hmm, it seems that it will only send one message. Check the deliver method from the default relay. It takes recipients as the To header string and directly sends it over SMTP. As described in the docs to_addresses should be a list. You should probably loop over the recipients in to, as well as in cc, as django does.

BTW, lamson has not been maintained for quite a while. You might want to take a look at the salmon fork.

@b0nd
Copy link
Author

b0nd commented Nov 6, 2013

Thanks for the tips tino!

Managed to get a dirty fix for the problem:

  1. Problem lies here in the handler queue https://github.com/zedshaw/lamson/blob/master/lamson/handlers/queue.py
    Everytime when control reaches here from https://github.com/zedshaw/lamson/blob/master/lamson/routing.py#L375, the 'to' field gets a new value based on email id's in 'cc' and 'bcc' and that's perfect. But q.push(message) pushes 'message' with everyloop over cc/bcc mail-ids and this 'message' is static with just 'to' field in it. This 'to' is the original 'to' and doesn't get changed with next loops and that is the problem. Hence multiple copies of same mail reaches to recipient listed in 'to' filed and those under 'cc'/'bcc' doesn't receive any.

Following is my dirty fix for queue.py:
def START(message, to=None, host=None):
"""
@stateless and routes however handlers.log.START routes (everything).
Has @nolocking, but that's alright since it's just writing to a maildir.
"""
q = queue.Queue('run/queue')
email = "%s@%s" % (to, host)
message = str(message)
s = re.sub(r'(?m)^\To:.*\n?', 'To: %s\n', message) % email
q.push(s)

Would be great if somebody could provide better solution for it.

Cheers!

@techmaniack
Copy link

Facing the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants