MailEnable - Create Account asp.net C#

dorathoto
Posts: 8
Joined: Wed Feb 26, 2014 11:04 pm

MailEnable - Create Account asp.net C#

Postby dorathoto » Wed Feb 26, 2014 11:06 pm

I'm trying to create an e-mail with MailEnable
based http://www.mailenable.com/developers/NET_SignUp.zip


Code: Select all

MailEnable.Administration.Login oLogin = new MailEnable.Administration.Login();
        oLogin.Account = iCliente.URL;
        oLogin.LastAttempt = -1;
        oLogin.LastSuccessfulLogin = -1;
        oLogin.LoginAttempts = -1;
        oLogin.Password = txt_Senha.Text;
        oLogin.Rights = "";
        oLogin.Status = -1;
        oLogin.UserName = txt_Email + "@" + iCliente.URL;
        if (oLogin.GetLogin() != 1)
        {
            oLogin.LastAttempt = 0;
            oLogin.LastSuccessfulLogin = 0;
            oLogin.LoginAttempts = 0;
            oLogin.Password = txt_Senha.Text;
            oLogin.Rights = "USER";
            oLogin.Status = 1;
        }

        MailEnable.Administration.Mailbox mailBoxCreate = new MailEnable.Administration.Mailbox();
        mailBoxCreate.Postoffice = iCliente.URL;
        mailBoxCreate.MailboxName = txt_Email.Text;
        mailBoxCreate.RedirectAddress = txt_Redirect.Text;
        mailBoxCreate.RedirectStatus = 0;//recuperar valor da checkbox
        mailBoxCreate.Limit = 51200; //-1 for unlimited
        mailBoxCreate.Status = 1;
        mailBoxCreate.AddMailbox();

        MailEnable.Administration.AddressMap mailAMap = new MailEnable.Administration.AddressMap();
        mailAMap.Account = iCliente.URL;
        mailAMap.DestinationAddress = "[SF:" + iCliente.URL + "/" + txt_Email.Text + "]";
        mailAMap.SourceAddress = "[SMTP:" + txt_Email.Text + "@" + iCliente.URL + "]";
        mailAMap.AddAddressMap();



But does not work, it creates the email but no password! :(

dorathoto
Posts: 8
Joined: Wed Feb 26, 2014 11:04 pm

Re: MailEnable - Create Account asp.net C#

Postby dorathoto » Fri Mar 14, 2014 5:34 pm

class finaly work perfect:

Code: Select all

    public class MailEnable_Geral
    {
        public string _Email { get; set; }
  public bool CriarEmail(string _senha, string _redirect, long _ativarRedirect)
        {
            string[] vPostoffice = _Email.Split('@');
            string _username = vPostoffice[0];
            string _postoffice = vPostoffice[1];
            string _domain = _postoffice;

            bool _retorno = true;
            try
            {
                MailEnable.Administration.Mailbox mb = new MailEnable.Administration.Mailbox();
                mb.Postoffice = _postoffice;
                mb.MailboxName = _username;
                mb.Host = _domain;
                mb.Limit = 51200;//50MB
                mb.RedirectAddress = _redirect;
                mb.RedirectStatus = _ativarRedirect;//Ativa ou desativa Redirect
                mb.Status = 1;

                mb.AddMailbox();

                MailEnable.Administration.Login login = new MailEnable.Administration.Login();
                login.Account = _postoffice;

                login.Description = _username + " at " + _domain;
                login.Host = _domain;
                login.Rights = "USER";
                login.Status = 1;
                login.Password = _senha;
                login.UserName = _username + "@" + _postoffice;

                login.AddLogin();

                MailEnable.Administration.AddressMap map = new MailEnable.Administration.AddressMap();
                map.Account = _postoffice;
                map.DestinationAddress = "[SF:" + _postoffice + "/" + _username + "]";
                map.SourceAddress = "[SMTP:" + _username + "@" + _domain + "]";
                map.Scope = "";

                if (map.AddAddressMap() == 0)
                {
                    throw new Exception("Failed address map");
                }
            }
            catch (Exception e)
            {
                _retorno = false;
            }
            return _retorno;
}}

Aqaash
Posts: 2
Joined: Sat Aug 30, 2014 10:31 am

Re: MailEnable - Create Account asp.net C#

Postby Aqaash » Sat Aug 30, 2014 10:44 am

Thanks for being post as a new guest :arrow:
http://www.eccouncil.org/
http://www.ucla.edu/
http://www.braindumps.com/C4040-224.htm
http://en.wikipedia.org/wiki/Alliant_International_University
https://www.facebook.com/Acer

Aqaash
Posts: 2
Joined: Sat Aug 30, 2014 10:31 am

Re: MailEnable - Create Account asp.net C#

Postby Aqaash » Sat Aug 30, 2014 10:44 am

Thanks for being post as a new guest :arrow:
http://www.eccouncil.org/
http://www.ucla.edu/
http://www.braindumps.com/C4040-224.htm
http://en.wikipedia.org/wiki/Alliant_International_University
https://www.facebook.com/Acer

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest