/// <summary>
        /// Send conformation email to customer <paramref name="email"/>
        /// </summary>
        /// <param name="email"></param>
        private void SendConfirmationEmail(string email)
        {
            EmailFactory factory = new EmailFactory();
            MailAddress  to      = factory.GetMailAddress(email);
            MailAddress  from    = factory.GetMailAddress("fromAddress");
            SmtpClient   client  = factory.GetSmtpClient();

            MailMessage message = factory.GetMailMessage(to, from);

            message.Body    = "Thank oyu for booking at us";
            message.Subject = "Thanks for your purchase!";

            EmailSender sender = factory.GetEmailSender(message, client, message.To.First(), message.From);

            sender.SendEmail();
        }
Ejemplo n.º 2
0
        protected override void DrawWindow(int windowId)
        {
            using (Helper.HeaderBeginHorizontal(SkinData))
            {
                if (Helper.Button(SkinData, "Close"))
                {
                    Hide();
                }

                GUILayout.FlexibleSpace();

                if (EmailFactory.GetEmailSender(DevelopmentConsole.Instance.EmailLogSupportEnabled).CanSendEmail() && Helper.Button(_skinData, "Email"))
                {
                    var body = $"{_logEntry.LogMessage}\n\n{_logEntry.StackTrace}";

                    var filename = Application.temporaryCachePath + "/log_" + DateTime.Now.ToString("o") + ".txt";
                    var writer   = new StreamWriter(filename);
                    writer.WriteLine(_logEntry.LogMessage);
                    writer.WriteLine(_logEntry.StackTrace);
                    writer.Close();

                    EmailFactory.GetEmailSender(DevelopmentConsole.Instance.EmailLogSupportEnabled).Email(
                        filename,
                        "text/plain",
                        filename,
                        "",
                        "Email Log",
                        body);
                }
            }

            _scrollPosition = GUILayout.BeginScrollView(_scrollPosition);

            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                GUI.enabled = false;
            }

            GUI.color = new UnityEngine.Color(1, 1, 1, 2);
            Helper.TextArea(SkinData, new GUIContent(_logEntry.LogMessage + "\n" + _logEntry.StackTrace), GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
            GUI.enabled = true;
            GUILayout.EndScrollView();

            GUI.FocusWindow(windowId);
            GUI.BringWindowToFront(windowId);
        }