Example #1
0
        public void Initialise(IConfigSource config)
        {
            m_Config = config;
            IConfig SMTPConfig;

            //FIXME: RegionName is correct??
            //m_RegionName = scene.RegionInfo.RegionName;

            IConfig startupConfig = m_Config.Configs["Startup"];

            m_Enabled = (startupConfig.GetString("emailmodule", "DefaultEmailModule") == "DefaultEmailModule");

            //Load SMTP SERVER config
            try
            {
                if ((SMTPConfig = m_Config.Configs["SMTP"]) == null)
                {
                    m_Enabled = false;
                    return;
                }

                if (!SMTPConfig.GetBoolean("enabled", false))
                {
                    m_Enabled = false;
                    return;
                }

                m_HostName            = SMTPConfig.GetString("host_domain_header_from", m_HostName);
                m_InterObjectHostname = SMTPConfig.GetString("internal_object_host", m_InterObjectHostname);
                SMTP_SERVER_HOSTNAME  = SMTPConfig.GetString("SMTP_SERVER_HOSTNAME", SMTP_SERVER_HOSTNAME);
                SMTP_SERVER_PORT      = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT);
                SMTP_SERVER_LOGIN     = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN);
                SMTP_SERVER_PASSWORD  = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD);
                m_MaxEmailSize        = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize);
            }
            catch (Exception e)
            {
                m_log.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message);
                m_Enabled = false;
                return;
            }
        }
Example #2
0
        public void Initialize(IConfigSource config, IRegistryCore registry)
        {
            m_Config = config;

            //Load SMTP SERVER config
            try
            {
                IConfig SMTPConfig;
                if ((SMTPConfig = m_Config.Configs["SMTP"]) == null)
                {
                    //MainConsole.Instance.InfoFormat("[SMTP] SMTP server not configured");
                    m_Enabled = false;
                    return;
                }
                m_Enabled = SMTPConfig.GetBoolean("enabled", true);
                if (!m_Enabled)
                {
                    m_Enabled = false;
                    return;
                }
                m_localOnly           = SMTPConfig.GetBoolean("local_only", true);
                m_HostName            = SMTPConfig.GetString("host_domain_header_from", m_HostName);
                m_InterObjectHostname = SMTPConfig.GetString("internal_object_host", m_InterObjectHostname);
                SMTP_SERVER_HOSTNAME  = SMTPConfig.GetString("SMTP_SERVER_HOSTNAME", SMTP_SERVER_HOSTNAME);
                SMTP_SERVER_PORT      = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT);
                SMTP_SERVER_LOGIN     = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN);
                SMTP_SERVER_PASSWORD  = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD);
                SMTP_SERVER_MONO_CERT = SMTPConfig.GetBoolean("SMTP_SERVER_MONO_CERT", SMTP_SERVER_MONO_CERT);
                m_MaxEmailSize        = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize);

                registry.RegisterModuleInterface <IEmailModule>(this);
                MainConsole.Instance.InfoFormat("[SMTP] Email enabled for {0}", m_localOnly ? "Local only" : "Full service");
            }
            catch (Exception e)
            {
                MainConsole.Instance.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message);
                m_Enabled = false;
            }
        }
Example #3
0
        public void Initialise(IConfigSource config)
        {
            m_Config = config;
            IConfig SMTPConfig;

            //Load SMTP SERVER config
            try
            {
                if ((SMTPConfig = m_Config.Configs["SMTP"]) == null)
                {
                    m_log.InfoFormat("[SMTP] SMTP server not configured");
                    m_Enabled = false;
                    return;
                }
                m_Enabled = SMTPConfig.GetBoolean("enabled", true);
                if (!m_Enabled)
                {
                    //m_log.InfoFormat("[SMTP] module disabled in configuration");
                    m_Enabled = false;
                    return;
                }
                m_localOnly           = SMTPConfig.GetBoolean("local_only", true);
                m_HostName            = SMTPConfig.GetString("host_domain_header_from", m_HostName);
                m_InterObjectHostname = SMTPConfig.GetString("internal_object_host", m_InterObjectHostname);
                SMTP_SERVER_HOSTNAME  = SMTPConfig.GetString("SMTP_SERVER_HOSTNAME", SMTP_SERVER_HOSTNAME);
                SMTP_SERVER_PORT      = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT);
                SMTP_SERVER_LOGIN     = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN);
                SMTP_SERVER_PASSWORD  = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD);
            }
            catch (Exception e)
            {
                m_log.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message);
                m_Enabled = false;
                return;
            }
        }
Example #4
0
        public void Initialize(Scene scene, IConfigSource config)
        {
            m_Config = config;
            IConfig SMTPConfig;

            //FIXME: RegionName is correct??
            //m_RegionName = scene.RegionInfo.RegionName;

            IConfig startupConfig = m_Config.Configs["Startup"];

            m_Enabled = (startupConfig.GetString("getemailmodule", "DefaultGetEmailModule") == "DefaultGetEmailModule");

            //Load SMTP SERVER config
            try
            {
                if ((SMTPConfig = m_Config.Configs["SMTP"]) == null)
                {
                    m_log.ErrorFormat("[InboundEmail]: SMTP not configured");
                    m_Enabled = false;
                    return;
                }

                if (!SMTPConfig.GetBoolean("inbound", true))
                {
                    m_log.WarnFormat("[InboundEmail]: Inbound email module disabled in configuration");
                    m_Enabled = false;
                    return;
                }

                // Database support
                _connectString = SMTPConfig.GetString("inbound_storage_connection", String.Empty);
                if (String.IsNullOrEmpty(_connectString))
                {
                    m_log.ErrorFormat("[InboundEmail]: Could not find SMTP inbound_storage_connection.");
                    m_Enabled = false;
                    return;
                }
                _connectionFactory = new ConnectionFactory("MySQL", _connectString);
                if (_connectionFactory == null)
                {
                    m_log.ErrorFormat("[InboundEmail]: Inbound email module could not create MySQL connection.");
                    m_Enabled = false;
                    return;
                }
            }
            catch (Exception e)
            {
                m_log.Error("[InboundEmail]: Inbound email not configured: " + e.Message);
                m_log.Error(e.StackTrace);
                m_Enabled = false;
                return;
            }

            // It's a go!
            if (m_Enabled)
            {
                lock (m_Scenes)
                {
                    // Claim the interface slot
                    scene.RegisterModuleInterface <IGetEmailModule>(this);

                    // Add to scene list
                    if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle))
                    {
                        m_Scenes[scene.RegionInfo.RegionHandle] = scene;
                    }
                    else
                    {
                        m_Scenes.Add(scene.RegionInfo.RegionHandle, scene);
                    }
                }

                m_log.Info("[InboundEmail]: Activated inbound email.");
            }
        }
        public void Initialise(Scene scene, IConfigSource config)
        {
            m_Config = config;
            IConfig SMTPConfig;

            //FIXME: RegionName is correct??
            //m_RegionName = scene.RegionInfo.RegionName;

            IConfig startupConfig = m_Config.Configs["Startup"];

            m_Enabled = (startupConfig.GetString("emailmodule", "DefaultEmailModule") == "DefaultEmailModule");

            //Load SMTP SERVER config
            try
            {
                if ((SMTPConfig = m_Config.Configs["SMTP"]) == null)
                {
                    m_log.InfoFormat("[SMTP] SMTP server not configured");
                    m_Enabled = false;
                    return;
                }

                if (!SMTPConfig.GetBoolean("enabled", false))
                {
                    m_log.InfoFormat("[SMTP] module disabled in configuration");
                    m_Enabled = false;
                    return;
                }

                m_HostName            = SMTPConfig.GetString("host_domain_header_from", m_HostName);
                m_InterObjectHostname = SMTPConfig.GetString("internal_object_host", m_InterObjectHostname);
                SMTP_SERVER_HOSTNAME  = SMTPConfig.GetString("SMTP_SERVER_HOSTNAME", SMTP_SERVER_HOSTNAME);
                SMTP_SERVER_PORT      = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT);
                SMTP_SERVER_LOGIN     = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN);
                SMTP_SERVER_PASSWORD  = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD);
            }
            catch (Exception e)
            {
                m_log.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message);
                m_Enabled = false;
                return;
            }

            // It's a go!
            if (m_Enabled)
            {
                lock (m_Scenes)
                {
                    // Claim the interface slot
                    scene.RegisterModuleInterface <IEmailModule>(this);

                    // Add to scene list
                    if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle))
                    {
                        m_Scenes[scene.RegionInfo.RegionHandle] = scene;
                    }
                    else
                    {
                        m_Scenes.Add(scene.RegionInfo.RegionHandle, scene);
                    }
                }

                m_log.Info("[EMAIL] Activated DefaultEmailModule");
            }
        }