コード例 #1
0
        public byte[] InsertEmail(OSDMap request)
        {
            Email message = new Email();

            message.FromOSD(request);
            OSDMap map = new OSDMap();

            map["Result"] = true;
            EmailConnector.InsertEmail(message);

            string       xmlString = OSDParser.SerializeJsonString(map);
            UTF8Encoding encoding  = new UTF8Encoding();

            return(encoding.GetBytes(xmlString));
        }
コード例 #2
0
        /// <summary>
        ///     SendMail function utilized by llEMail
        /// </summary>
        /// <param name="objectID"></param>
        /// <param name="address"></param>
        /// <param name="subject"></param>
        /// <param name="body"></param>
        /// <param name="scene">Can be null</param>
        public void SendEmail(UUID objectID, string address, string subject, string body, IScene scene)
        {
            //Check if address is empty
            if (address == string.Empty)
            {
                return;
            }

            bool isEMailStrictMatch = Utilities.IsValidEmail(address);

            if (!isEMailStrictMatch)
            {
                MainConsole.Instance.Error("[EMAIL] REGEX Problem in EMail Address: " + address);
                return;
            }
            //FIXME:Check if subject + body = 4096 Byte
            if ((subject.Length + body.Length) > m_MaxEmailSize)
            {
                MainConsole.Instance.Error("[EMAIL] subject + body larger than limit of " + m_MaxEmailSize + " bytes");
                return;
            }

            string LastObjectName       = string.Empty;
            string LastObjectPosition   = string.Empty;
            string LastObjectRegionName = string.Empty;

            if (scene != null)
            {
                resolveNamePositionRegionName(objectID, out LastObjectName, out LastObjectPosition,
                                              out LastObjectRegionName, scene);
            }

            if (!address.EndsWith(m_InterObjectHostname))
            {
                bool didError = false;
                if (!m_localOnly)
                {
                    // regular email, send it out
                    Thread threadSendMail;
                    threadSendMail = new Thread(delegate()
                    {
                        try
                        {
                            //Creation EmailMessage

                            string fromEmailAddress;

                            if (scene != null && objectID != UUID.Zero)
                            {
                                fromEmailAddress = objectID + "@" + m_HostName;
                            }
                            else
                            {
                                fromEmailAddress = "no-reply@" + m_HostName;
                            }

                            var fromAddress = new MailAddress(fromEmailAddress);
                            var toAddress   = new MailAddress(address);

                            if (scene != null)
                            {
                                // If Object Null Don't Include Object Info Headers (Offline IMs)
                                if (objectID != UUID.Zero)
                                {
                                    body = body + "\nObject-Name: " + LastObjectName +
                                           "\nRegion: " + LastObjectRegionName + "\nLocal-Position: " +
                                           LastObjectPosition + "\n\n";
                                }
                            }

                            //Config SMTP Server
                            var smtpServer                   = new SmtpClient();
                            smtpServer.Host                  = SMTP_SERVER_HOSTNAME;
                            smtpServer.Port                  = SMTP_SERVER_PORT;
                            smtpServer.EnableSsl             = SMTP_SERVER_PORT == 587 ? true: false;
                            smtpServer.DeliveryMethod        = SmtpDeliveryMethod.Network;
                            smtpServer.UseDefaultCredentials = false;
                            smtpServer.Credentials           = new NetworkCredential(SMTP_SERVER_LOGIN, SMTP_SERVER_PASSWORD);
                            smtpServer.Timeout               = 15000;

                            ServicePointManager.ServerCertificateValidationCallback = delegate
                            {
                                return(true);
                            };

                            // create the message
                            var emailMessage     = new MailMessage(fromAddress, toAddress);
                            emailMessage.Subject = subject;
                            emailMessage.Body    = body;

                            // send the message
                            try
                            {
                                smtpServer.Send(emailMessage);
                            } catch (SmtpException ex)
                            {
                                SmtpStatusCode status = ex.StatusCode;
                                if (status == SmtpStatusCode.Ok)
                                {
                                    MainConsole.Instance.Info("[EMAIL] EMail sent to: " + address + " from object: " +
                                                              fromEmailAddress);
                                }
                                else
                                {
                                    MainConsole.Instance.Info("[EMAIL] EMail error sending to: " + address + " from object: " +
                                                              fromEmailAddress + " status: " + ex.Message);
                                }
                            }
                        } catch (Exception e)
                        {
                            MainConsole.Instance.Error("[EMAIL] DefaultEmailModule Exception: " + e.Message);
                            didError = true;
                        }
                    });

                    threadSendMail.IsBackground = true;
                    threadSendMail.Start();
                }
                if (((didError) || (m_localOnly)) && (scene != null))
                {
                    // Notify Owner
                    ISceneChildEntity part = findPrim(objectID, out LastObjectRegionName, scene);
                    if (part != null)
                    {
                        IScenePresence sp = scene.GetScenePresence(part.OwnerID);
                        if ((sp != null) && (!sp.IsChildAgent))
                        {
                            sp.ControllingClient.SendAlertMessage(
                                "llEmail: email module not configured for outgoing emails");
                        }
                    }
                }
            }
            else
            {
                // inter object email, keep it in the family
                string guid = address.Substring(0, address.IndexOf("@", StringComparison.Ordinal));
                UUID   toID = new UUID(guid);

                if (IsLocal(toID, scene))
                {
                    // object in this region
                    InsertEmail(toID, new Email
                    {
                        time =
                            ((int)
                             ((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds))
                            .
                            ToString(CultureInfo.InvariantCulture),
                        subject = subject,
                        sender  = objectID.ToString() + "@" + m_InterObjectHostname,
                        message = "Object-Name: " + LastObjectName +
                                  "\nRegion: " + LastObjectRegionName + "\nLocal-Position: " +
                                  LastObjectPosition + "\n\n" + body,
                        toPrimID = toID
                    });
                }
                else
                {
                    // object on another region

                    Email email = new Email
                    {
                        time =
                            ((int)
                             ((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds)).
                            ToString(CultureInfo.InvariantCulture),
                        subject  = subject,
                        sender   = objectID.ToString() + "@" + m_InterObjectHostname,
                        message  = body,
                        toPrimID = toID
                    };
                    IEmailConnector conn = Framework.Utilities.DataManager.RequestPlugin <IEmailConnector>();
                    conn.InsertEmail(email);
                }
            }
        }
コード例 #3
0
        /// <summary>
        ///     SendMail function utilized by llEMail
        /// </summary>
        /// <param name="objectID"></param>
        /// <param name="address"></param>
        /// <param name="subject"></param>
        /// <param name="body"></param>
        /// <param name="scene">Can be null</param>
        public void SendEmail(UUID objectID, string address, string subject, string body, IScene scene)
        {
            //Check if address is empty
            if (address == string.Empty)
            {
                return;
            }

            bool isEMailStrictMatch = Utilities.IsValidEmail(address);

            if (!isEMailStrictMatch)
            {
                MainConsole.Instance.Error("[Email]: REGEX Problem in EMail Address: " + address);
                return;
            }
            // Check if subject + body = max size (4096) Byte
            if ((subject.Length + body.Length) > m_MaxEmailSize)
            {
                MainConsole.Instance.Error("[Email]: subject + body larger than limit of " + m_MaxEmailSize + " bytes");
                return;
            }

            string LastObjectName       = string.Empty;
            string LastObjectPosition   = string.Empty;
            string LastObjectRegionName = string.Empty;

            if (scene != null)
            {
                resolveNamePositionRegionName(objectID, out LastObjectName, out LastObjectPosition,
                                              out LastObjectRegionName, scene);
            }

            if (!address.EndsWith(m_InterObjectHostname, StringComparison.Ordinal))
            {
                bool didError = false;
                if (!m_localOnly)
                {
                    // regular email, send it out
                    Thread threadSendMail;
                    threadSendMail = new Thread(delegate() {
                        try {
                            // Create EmailMessage
                            string fromEmailAddress;

                            if (scene != null && objectID != UUID.Zero)
                            {
                                fromEmailAddress = objectID + "@" + m_HostName;
                            }
                            else
                            {
                                fromEmailAddress = "no-reply@" + m_HostName;
                            }

                            // 20180128 Implementing the new way to send (secure) emails
                            var message = new MimeMessage();
                            message.From.Add(new MailboxAddress(LastObjectName, fromEmailAddress));
                            message.To.Add(new MailboxAddress(address));
                            //var fromAddress = new MailAddress (fromEmailAddress);
                            //var toAddress = new MailAddress (address);

                            if (scene != null)
                            {
                                // If Object Null Don't Include Object Info Headers (Offline IMs)
                                if (objectID != UUID.Zero)
                                {
                                    body = body + "\nObject-Name: " + LastObjectName +
                                           "\nRegion: " + LastObjectRegionName + "\nLocal-Position: " +
                                           LastObjectPosition + "\n\n";
                                }
                            }
                            message.Subject = subject;
                            message.Body    = new TextPart(body);
                            // End implementation for making the email header / body

                            /*
                             * //Config SMTP Server
                             * var smtpServer = new SmtpClient ();
                             * smtpServer.Host = SMTP_SERVER_HOSTNAME;
                             * smtpServer.Port = SMTP_SERVER_PORT;
                             * smtpServer.EnableSsl = (SMTP_SERVER_PORT == 587);
                             * smtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
                             * smtpServer.UseDefaultCredentials = false;
                             * smtpServer.Credentials = new NetworkCredential (SMTP_SERVER_LOGIN, SMTP_SERVER_PASSWORD);
                             * smtpServer.Timeout = 15000;
                             *
                             * // Beware !! This effectively ignores the ssl validation and assumes that all is correct
                             * // For Mono, requires importation of the Google smtpd certificate (see SMTPEmail.ini)
                             * // Possibly not needed for Windows
                             * //ServicePointManager.ServerCertificateValidationCallback =
                             * //    delegate(object sim, X509Certificate certificate, X509Chain chain SslPolicyErrors sslPolicyErrors)
                             * //{ return true; };
                             *
                             * // if ((!SMTP_SERVER_MONO_CERT) && (Utilities.IsLinuxOs))
                             * ServicePointManager.ServerCertificateValidationCallback = delegate {
                             *  return true;
                             * };
                             *
                             * // create the message
                             * var emailMessage = new MailMessage (fromAddress, toAddress);
                             * emailMessage.Subject = subject;
                             * emailMessage.Body = body;
                             *
                             * // sample for adding attachments is needed sometime :)
                             * //if File(Exist(fullFileName))
                             * //{
                             * //    var mailAttactment = new Attachment(fullFileName);
                             * //    emailMessage.Attachments.Add(mailAttactment);
                             * //}
                             */

                            var client = new SmtpClient();
                            client.ServerCertificateValidationCallback = (s, c, h, e) => true;
                            client.Connect(SMTP_SERVER_HOSTNAME, SMTP_SERVER_PORT, false);
                            client.Authenticate(SMTP_SERVER_LOGIN, SMTP_SERVER_PASSWORD);
                            // send the message
                            try
                            {
                                client.Send(message);
                            } catch (SmtpCommandException ex) {
                                SmtpStatusCode status = ex.StatusCode;
                                if (status == SmtpStatusCode.Ok)
                                {
                                    MainConsole.Instance.Info("[Email]: EMail sent to: " + address + " from object: " +
                                                              fromEmailAddress);
                                }
                                else
                                {
                                    MainConsole.Instance.Info("[Email]: EMail error sending to: " + address + " from object: " +
                                                              fromEmailAddress + " status: " + ex.Message);
                                }
                            }
                            client.Disconnect(true);
                        } catch (Exception e) {
                            MainConsole.Instance.Error("[Email]: DefaultEmailModule Exception: " + e.Message);
                            didError = true;
                        }
                    });

                    threadSendMail.IsBackground = true;
                    threadSendMail.Start();
                }
                if (((didError) || (m_localOnly)) && (scene != null))
                {
                    // Notify Owner
                    ISceneChildEntity part = findPrim(objectID, out LastObjectRegionName, scene);
                    if (part != null)
                    {
                        IScenePresence sp = scene.GetScenePresence(part.OwnerID);
                        if ((sp != null) && (!sp.IsChildAgent))
                        {
                            sp.ControllingClient.SendAlertMessage("llEmail: email module not configured for outgoing emails");
                        }
                    }
                }
            }
            else
            {
                // inter object email, keep it in the family
                string guid = address.Substring(0, address.IndexOf("@", StringComparison.Ordinal));
                UUID   toID = new UUID(guid);

                if (IsLocal(toID, scene))
                {
                    // object in this region
                    InsertEmail(toID, new Email {
                        time    = ((int)((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds)).ToString(CultureInfo.InvariantCulture),
                        subject = subject,
                        sender  = objectID + "@" + m_InterObjectHostname,
                        message = "Object-Name: " + LastObjectName + "\nRegion: " + LastObjectRegionName + "\nLocal-Position: " +
                                  LastObjectPosition + "\n\n" + body,
                        toPrimID = toID
                    });
                }
                else
                {
                    // object on another region

                    Email email = new Email {
                        time     = ((int)((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds)).ToString(CultureInfo.InvariantCulture),
                        subject  = subject,
                        sender   = objectID + "@" + m_InterObjectHostname,
                        message  = body,
                        toPrimID = toID
                    };
                    IEmailConnector conn = Framework.Utilities.DataManager.RequestPlugin <IEmailConnector> ();
                    conn.InsertEmail(email);
                }
            }
        }
コード例 #4
0
        private int m_MaxEmailSize           = 4096; // largest email allowed by default, as per lsl docs.

        #region IEmailModule Members

        /// <summary>
        ///     SendMail function utilized by llEMail
        /// </summary>
        /// <param name="objectID"></param>
        /// <param name="address"></param>
        /// <param name="subject"></param>
        /// <param name="body"></param>
        /// <param name="scene">Can be null</param>
        public void SendEmail(UUID objectID, string address, string subject, string body, IScene scene)
        {
            //Check if address is empty
            if (address == string.Empty)
            {
                return;
            }

            //FIXED:Check the email is correct form in REGEX
            const string EMailpatternStrict = @"^(([^<>()[\]\\.,;:\s@\""]+"
                                              + @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@"
                                              + @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
                                              + @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+"
                                              + @"[a-zA-Z]{2,}))$";
            Regex EMailreStrict      = new Regex(EMailpatternStrict);
            bool  isEMailStrictMatch = EMailreStrict.IsMatch(address);

            if (!isEMailStrictMatch)
            {
                MainConsole.Instance.Error("[EMAIL] REGEX Problem in EMail Address: " + address);
                return;
            }
            //FIXME:Check if subject + body = 4096 Byte
            if ((subject.Length + body.Length) > m_MaxEmailSize)
            {
                MainConsole.Instance.Error("[EMAIL] subject + body larger than limit of " + m_MaxEmailSize + " bytes");
                return;
            }

            string LastObjectName       = string.Empty;
            string LastObjectPosition   = string.Empty;
            string LastObjectRegionName = string.Empty;

            if (scene != null)
            {
                resolveNamePositionRegionName(objectID, out LastObjectName, out LastObjectPosition,
                                              out LastObjectRegionName, scene);
            }

            if (!address.EndsWith(m_InterObjectHostname))
            {
                bool didError = false;
                if (!m_localOnly)
                {
                    // regular email, send it out
                    try
                    {
                        //Creation EmailMessage

                        string fromEmailAddress = "@" + m_HostName;
                        if (scene != null)
                        {
                            fromEmailAddress = objectID.ToString() + "@" + m_HostName;
                        }
                        else
                        {
                            fromEmailAddress = "noreply@" + m_HostName;
                        }
                        EmailMessage emailMessage = new EmailMessage
                        {
                            FromAddress =
                                new EmailAddress(fromEmailAddress),
                            Subject = subject
                        };

                        //To - Only One
                        emailMessage.AddToAddress(new EmailAddress(address));
                        //Text
                        emailMessage.BodyText = body;
                        if (scene != null)
                        {
                            emailMessage.BodyText = "Object-Name: " + LastObjectName +
                                                    "\nRegion: " + LastObjectRegionName + "\nLocal-Position: " +
                                                    LastObjectPosition + "\n\n" + emailMessage.BodyText;
                        }

                        //Config SMTP Server
                        //Set SMTP SERVER config
                        SmtpServer smtpServer = new SmtpServer(SMTP_SERVER_HOSTNAME, SMTP_SERVER_PORT);
                        // Add authentication only when requested
                        if (SMTP_SERVER_LOGIN != String.Empty && SMTP_SERVER_PASSWORD != String.Empty)
                        {
                            smtpServer.SmtpAuthToken = new SmtpAuthToken(SMTP_SERVER_LOGIN, SMTP_SERVER_PASSWORD);
                        }
                        //Add timeout of 15 seconds
                        smtpServer.ServerTimeout = 15000;
                        //Send Email Message
                        didError = !emailMessage.Send(smtpServer);

                        //Log
                        if (!didError)
                        {
                            MainConsole.Instance.Info("[EMAIL] EMail sent to: " + address + " from object: " +
                                                      fromEmailAddress);
                        }
                    }
                    catch (Exception e)
                    {
                        MainConsole.Instance.Error("[EMAIL] DefaultEmailModule Exception: " + e.Message);
                        didError = true;
                    }
                }
                if (((didError) || (m_localOnly)) && (scene != null))
                {
                    // Notify Owner
                    ISceneChildEntity part = findPrim(objectID, out LastObjectRegionName, scene);
                    if (part != null)
                    {
                        IScenePresence sp = scene.GetScenePresence(part.OwnerID);
                        if ((sp != null) && (!sp.IsChildAgent))
                        {
                            sp.ControllingClient.SendAlertMessage(
                                "llEmail: email module not configured for outgoing emails");
                        }
                    }
                }
            }
            else
            {
                // inter object email, keep it in the family
                string guid = address.Substring(0, address.IndexOf("@", StringComparison.Ordinal));
                UUID   toID = new UUID(guid);

                if (IsLocal(toID, scene))
                {
                    // object in this region
                    InsertEmail(toID, new Email
                    {
                        time =
                            ((int)
                             ((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds))
                            .
                            ToString(CultureInfo.InvariantCulture),
                        subject = subject,
                        sender  = objectID.ToString() + "@" + m_InterObjectHostname,
                        message = "Object-Name: " + LastObjectName +
                                  "\nRegion: " + LastObjectRegionName + "\nLocal-Position: " +
                                  LastObjectPosition + "\n\n" + body,
                        toPrimID = toID
                    });
                }
                else
                {
                    // object on another region

                    Email email = new Email
                    {
                        time =
                            ((int)
                             ((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds)).
                            ToString(CultureInfo.InvariantCulture),
                        subject  = subject,
                        sender   = objectID.ToString() + "@" + m_InterObjectHostname,
                        message  = body,
                        toPrimID = toID
                    };
                    IEmailConnector conn = Framework.Utilities.DataManager.RequestPlugin <IEmailConnector>();
                    conn.InsertEmail(email);
                }
            }
        }
コード例 #5
0
ファイル: EmailModule.cs プロジェクト: nhede/WhiteCore-Dev
        /// <summary>
        ///     SendMail function utilized by llEMail
        /// </summary>
        /// <param name="objectID"></param>
        /// <param name="address"></param>
        /// <param name="subject"></param>
        /// <param name="body"></param>
        /// <param name="scene">Can be null</param>
        public void SendEmail(UUID objectID, string address, string subject, string body, IScene scene)
        {
            //Check if address is empty
            if (address == string.Empty)
            {
                return;
            }

            /*
             * //FIXED:Check the email is correct form in REGEX
             * //const string EMailpatternStrict = @"^(([^<>()[\]\\.,;:\s@\""]+"
             * //                                  + @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@"
             * //                                  + @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
             * //                                  + @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+"
             * //                                  + @"[a-zA-Z]{2,}))$";
             */
            //Regex EMailreStrict = new Regex(EMailpatternStrict);
            //bool isEMailStrictMatch = EMailreStrict.IsMatch(address);
            bool isEMailStrictMatch = Utilities.IsValidEmail(address);

            if (!isEMailStrictMatch)
            {
                MainConsole.Instance.Error("[EMAIL] REGEX Problem in EMail Address: " + address);
                return;
            }
            //FIXME:Check if subject + body = 4096 Byte
            if ((subject.Length + body.Length) > m_MaxEmailSize)
            {
                MainConsole.Instance.Error("[EMAIL] subject + body larger than limit of " + m_MaxEmailSize + " bytes");
                return;
            }

            string LastObjectName       = string.Empty;
            string LastObjectPosition   = string.Empty;
            string LastObjectRegionName = string.Empty;

            if (scene != null)
            {
                resolveNamePositionRegionName(objectID, out LastObjectName, out LastObjectPosition,
                                              out LastObjectRegionName, scene);
            }

            if (!address.EndsWith(m_InterObjectHostname))
            {
                bool didError = false;
                if (!m_localOnly)
                {
                    // regular email, send it out
                    Thread threadSendMail;
                    threadSendMail = new Thread(delegate()
                    {
                        try
                        {
                            //Creation EmailMessage

                            string fromEmailAddress;

                            if (scene != null && objectID != UUID.Zero)
                            {
                                fromEmailAddress = objectID + "@" + m_HostName;
                            }
                            else
                            {
                                fromEmailAddress = "no-reply@" + m_HostName;
                            }

                            var fromAddress = new MailAddress(fromEmailAddress);
                            var toAddress   = new MailAddress(address);

                            if (scene != null)
                            {
                                // If Object Null Don't Include Object Info Headers (Offline IMs)
                                if (objectID != UUID.Zero)
                                {
                                    body = body + "\nObject-Name: " + LastObjectName +
                                           "\nRegion: " + LastObjectRegionName + "\nLocal-Position: " +
                                           LastObjectPosition + "\n\n";
                                }
                            }

                            //Config SMTP Server
                            var smtpServer                   = new SmtpClient();
                            smtpServer.Host                  = SMTP_SERVER_HOSTNAME;
                            smtpServer.Port                  = SMTP_SERVER_PORT;
                            smtpServer.EnableSsl             = SMTP_SERVER_PORT == 587 ? true: false;
                            smtpServer.DeliveryMethod        = SmtpDeliveryMethod.Network;
                            smtpServer.UseDefaultCredentials = false;
                            smtpServer.Credentials           = new NetworkCredential(SMTP_SERVER_LOGIN, SMTP_SERVER_PASSWORD);
                            smtpServer.Timeout               = 15000;

                            // Beware !! This effectively ignores the ssl validation and assumes that all is correct
                            // For Mono, requires importation of the Google smtpd certificate (see SMTPEmail.ini.example)
                            // Possibly not needed for Windows
                            //ServicePointManager.ServerCertificateValidationCallback =
                            //    delegate(object sim, X509Certificate certificate, X509Chain chain SslPolicyErrors sslPolicyErrors)
                            //{ return true; };

                            // if ((!SMTP_SERVER_MONO_CERT) && (Utilities.IsLinuxOs))
                            ServicePointManager.ServerCertificateValidationCallback = delegate {
                                return(true);
                            };

                            // create the message
                            var emailMessage     = new MailMessage(fromAddress, toAddress);
                            emailMessage.Subject = subject;
                            emailMessage.Body    = body;

                            // sample for adding attachments is needed sometime :)
                            //if File(Exist(fullFileName))
                            //{
                            //    var mailAttactment = new Attachment(fullFileName);
                            //    emailMessage.Attachments.Add(mailAttactment);
                            //}

                            // send the message
                            try
                            {
                                smtpServer.Send(emailMessage);
                            } catch (SmtpException ex)
                            {
                                SmtpStatusCode status = ex.StatusCode;
                                if (status == SmtpStatusCode.Ok)
                                {
                                    MainConsole.Instance.Info("[EMAIL] EMail sent to: " + address + " from object: " +
                                                              fromEmailAddress);
                                }
                                else
                                {
                                    MainConsole.Instance.Info("[EMAIL] EMail error sending to: " + address + " from object: " +
                                                              fromEmailAddress + " status: " + ex.Message);
                                }
                            }
                        } catch (Exception e)
                        {
                            MainConsole.Instance.Error("[EMAIL] DefaultEmailModule Exception: " + e.Message);
                            didError = true;
                        }
                    });

                    threadSendMail.IsBackground = true;
                    threadSendMail.Start();
                }
                if (((didError) || (m_localOnly)) && (scene != null))
                {
                    // Notify Owner
                    ISceneChildEntity part = findPrim(objectID, out LastObjectRegionName, scene);
                    if (part != null)
                    {
                        IScenePresence sp = scene.GetScenePresence(part.OwnerID);
                        if ((sp != null) && (!sp.IsChildAgent))
                        {
                            sp.ControllingClient.SendAlertMessage(
                                "llEmail: email module not configured for outgoing emails");
                        }
                    }
                }
            }
            else
            {
                // inter object email, keep it in the family
                string guid = address.Substring(0, address.IndexOf("@", StringComparison.Ordinal));
                UUID   toID = new UUID(guid);

                if (IsLocal(toID, scene))
                {
                    // object in this region
                    InsertEmail(toID, new Email
                    {
                        time =
                            ((int)
                             ((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds))
                            .
                            ToString(CultureInfo.InvariantCulture),
                        subject = subject,
                        sender  = objectID.ToString() + "@" + m_InterObjectHostname,
                        message = "Object-Name: " + LastObjectName +
                                  "\nRegion: " + LastObjectRegionName + "\nLocal-Position: " +
                                  LastObjectPosition + "\n\n" + body,
                        toPrimID = toID
                    });
                }
                else
                {
                    // object on another region

                    Email email = new Email
                    {
                        time =
                            ((int)
                             ((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds)).
                            ToString(CultureInfo.InvariantCulture),
                        subject  = subject,
                        sender   = objectID.ToString() + "@" + m_InterObjectHostname,
                        message  = body,
                        toPrimID = toID
                    };
                    IEmailConnector conn = Framework.Utilities.DataManager.RequestPlugin <IEmailConnector>();
                    conn.InsertEmail(email);
                }
            }
        }