啊鑫
2024-07-11 afbf8700d137710713db61955879d0f5acb73738
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#region
 
using System;
using System.IO;
 
#endregion
 
namespace CSFrameworkV5.Models
{
    [Serializable]
    public class TAttachmentBody
    {
        private byte[] _Content;
        private string _FileName = "";
 
        public byte[] Content
        {
            get => _Content;
            set => _Content = value;
        }
 
        public string FileName
        {
            get => _FileName;
            set => _FileName = value;
        }
 
        public void LoadFromFile(string attachedFile)
        {
            FileStream fs = null;
            try
            {
                fs = File.OpenRead(attachedFile);
                _Content = new byte[fs.Length];
                _FileName = Path.GetFileName(attachedFile);
                fs.Read(_Content, 0, _Content.Length);
                fs.Close();
                fs.Dispose();
            }
            catch
            {
                if (fs != null)
                {
                    fs.Close();
                    fs.Dispose();
                }
            }
        }
    }
 
    [Serializable]
    public class TEmailBody
    {
        private TAttachmentBody[] _Attachments;
        private string _BC = "";
        private string _CC = "";
        private string _Content = "";
        private string _From = "";
        private string _Subject = "";
        private string _To = "";
        private string _UserID = "";
 
        public TAttachmentBody[] Attachments
        {
            get => _Attachments;
            set => _Attachments = value;
        }
 
        public string BC
        {
            get => _BC;
            set => _BC = value;
        }
 
        public string CC
        {
            get => _CC;
            set => _CC = value;
        }
 
        public string Content
        {
            get => _Content;
            set => _Content = value;
        }
 
        public string From
        {
            get => _From;
            set => _From = value;
        }
 
        public string Subject
        {
            get => _Subject;
            set => _Subject = value;
        }
 
        public string To
        {
            get => _To;
            set => _To = value;
        }
 
        public string UserID
        {
            get => _UserID;
            set => _UserID = value;
        }
 
        public string GetAttachmentFileNames()
        {
            if (_Attachments == null) return "";
 
            var names = "";
            foreach (var a in _Attachments) names = a.FileName + "," + names;
 
            return names;
        }
    }
}