cosullivan / SmtpServer

A SMTP Server component written in C#
MIT License
692 stars 163 forks source link

working with Distribution List (Group Email Id) #110

Closed PinnacleCoders closed 4 years ago

PinnacleCoders commented 5 years ago

Hello Cain, I'm using this SMTP Server as relay server to relay emails . It works well for end user email ids , but it fails to identify whether recipient is a group ID. Due to this it is not able to send emails to users in the Group ID. Any suggestion what changes can done here?

cosullivan commented 5 years ago

Hi,

I'm not sure what you mean by a Group ID?

PinnacleCoders commented 5 years ago

There is a provision in Mail Servers where you can create a group and have users listed under that group. Example: you can have group id alldevelopers@xyz.com and have all developer users listed under it. So if one wants to send email to all developers he\she can send it to alldevelopers@xyz.com rather than mentioning each developer user's email id under to\cc\Bcc.

The current problem is the SMTP server (which is acting like a relay server) does not understand whether the recipients in the request is a user id or group id (alldevelopers@xyz.com). In case its a group Id, it is required that this group Id be interpreted to list of users.

cosullivan commented 5 years ago

This logic would need to be done within your own implementation of IMessageStore. You would need to maintain a list of groups then instead of relaying to a single address, peform the lookup on the group and relay to each email address in the group.

The RFC for SMTP does include a EXPN command to expand groups, but that does nothing more than just allowing the users of the group to be listed to the client. I have not currently implemented that as it's not commonly used, but it would't help you anyway.