Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# XscorX 2/20/2008 3:31 PM
i was creating a page for automatic removal of the users acording to conditions

then i wanted to send to this user an email telling him that his user got deleted

but i can't find a way to access the DefaultEmailService

can you help me
# YKS 2/20/2008 3:57 PM (edited 2/20/2008 4:03 PM)
public class RemovalUsersBaseModule: ModuleBase
    {

        IEmailService _emailservice;
  

        public WebUserModule( IEmailService emailservice)
        {
             this._emailservice=emailservice;
        }

        public void SendEmail(params)
        {
            return this._emailservice.ProcessEmail(params);
        }
}

public class RemovalUsersAdminPage : ModuleAdminBasePage
    {

RemovalUsersBaseModule  _module;

     		private void Page_Load(object sender, System.EventArgs e)
		{
            this._module = base.Module as RemovalUsersBaseModule;
            
		}
  

        public RemoveUsers( )
        {
           this._module.SendEmails(params);
        }

       
   
}
# XscorX 2/20/2008 4:14 PM
i have tried that
but the problem is that i cam not creating a new module
i am adding a page in the
Cuyahoga.Web.Admin

and this pages do not inherit ModuleAdminBasePage nor BaseModuleControl but inherit AdminBasePage
which does not include definition for module to help me define a new one
# martijnb 2/20/2008 5:53 PM
You can obtain an instance of IEmailService via:
public class MyAdminPage
{
    private IEmailService _emailService;

    public MyAdminPage()
    {
        this._emailService = Container.Resolve[IEmailService]();
    }
}

(and replace the square brackets with angled brackets)
# XscorX 2/21/2008 1:21 PM
thanks martijnb
it worked