Author |
|
reena_bharti Newbie
Joined: 11 November 2006 Location: United States
Online Status: Offline Posts: 8
|
Posted: 22 May 2007 at 2:45pm | IP Logged
|
|
|
hi
I am using Mailbee IMAP and SMTP components in an application where every user has their own personal email account.
We have a requirement of not sending emails to any external domain like yahoo, gmail etc. Is there any way that i can write in code that can restrict all users from sending emails to all external domains from application end itself.
Thanks
-- Reena
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 22 May 2007 at 3:35pm | IP Logged
|
|
|
If you're sending all mails via a dedicated SMTP server, you can disable SMTP authentication when sending through this servers. Most SMTP servers are configured not to allow sending to external addresses if SMTP authentication is not enabled.
By default, SMTP authentication is disabled in both MailBee SMTP and MailBee.NET SMTP components. Thus, you should either do nothing or disable it if you enabled it before.
However, if you do not even want to connect to the server in the case of external address, you'll have to test if the address is local or not. For instance, you can iterate through mailer.Message.GetAllRecipients() collection (assuming mailer is Smtp instance) and call GetDomain for every EmailAddress returned. Then you should compare this address with the domain names you accept as local ones. If any non-local address detected, you report error to the user.
Regards,
Alex
|
Back to Top |
|
|