コード例 #1
0
        public string Commit(UseSendMailEngine mail_engine, bool IsBodyHtml)
        {
            string _result = string.Empty;

            try
            {
                switch (mail_engine)
                {
                case UseSendMailEngine.SystemWebMail:
                    Functions.SendEmail(_from, string.Empty, _to, string.Empty, null, _subject, _body, _files, IsBodyHtml);
                    break;

                case UseSendMailEngine.NotificationService:
                    XmlSerializer _serializer = new XmlSerializer(typeof(MailNotification));
                    TextWriter    _stream     = new StringWriter();
                    _serializer.Serialize(_stream, this);
                    string _object_state = _stream.ToString();
                    _stream.Close();
                    NotificationRules.TicketEvent _event = IsBodyHtml ? NotificationRules.TicketEvent.DirectMailAsHTML : NotificationRules.TicketEvent.DirectMail;
                    int _operation_result = NotificationEventsQueue.InsertEvent(_org_id, _department_id, _user_id, _event, _object_state, _files);
                    if (_operation_result <= 0)
                    {
                        _result = "Can't add mass mailes to NotificationEventsQueue.";
                    }

                    break;
                }
                ;
            }
            catch (Exception ex)
            {
                _result = ex.Message;
            };

            return(_result);
        }
コード例 #2
0
        public string Commit(UseSendMailEngine mail_engine, bool IsBodyHtml)
        {
            string _result = string.Empty;

            try
            {
                switch (mail_engine)
                {
                    case UseSendMailEngine.SystemWebMail:
                        Functions.SendEmail(_from, string.Empty, _to, string.Empty, null, _subject, _body, _files, IsBodyHtml);
                        break;
                    case UseSendMailEngine.NotificationService:
                        XmlSerializer _serializer = new XmlSerializer(typeof(MailNotification));
                        TextWriter _stream = new StringWriter();
                        _serializer.Serialize(_stream, this);
                        string _object_state = _stream.ToString();
                        _stream.Close();
                        NotificationRules.TicketEvent _event = IsBodyHtml ? NotificationRules.TicketEvent.DirectMailAsHTML : NotificationRules.TicketEvent.DirectMail;
                        int _operation_result = NotificationEventsQueue.InsertEvent(_org_id, _department_id, _user_id, _event, _object_state, _files);
                        if (_operation_result <= 0)
                            _result = "Can't add mass mailes to NotificationEventsQueue.";

                        break;
                };
            }
            catch (Exception ex)
            {
                _result = ex.Message;
            };

            return _result;
        }