1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.MonoRail
.Framework
.Configuration
21 /// Represents the SMTP configuration
22 /// on the configuration file
24 public class SmtpConfig
: ISerializedConfig
26 private String host
= "localhost";
27 private int port
= 25;
28 private String username
;
29 private String password
;
32 /// Deserializes the specified smtp section.
34 /// <param name="section">The smtp section.</param>
35 public void Deserialize(XmlNode section
)
37 XmlAttribute smtpHostAtt
= section
.Attributes
["smtpHost"];
38 XmlAttribute smtpPortAtt
= section
.Attributes
["smtpPort"];
39 XmlAttribute smtpUserAtt
= section
.Attributes
["smtpUsername"];
40 XmlAttribute smtpPwdAtt
= section
.Attributes
["smtpPassword"];
42 if (smtpHostAtt
!= null && smtpHostAtt
.Value
!= String
.Empty
)
44 host
= smtpHostAtt
.Value
;
46 if (smtpPortAtt
!= null && smtpPortAtt
.Value
!= String
.Empty
)
48 port
= int.Parse(smtpPortAtt
.Value
);
50 if (smtpUserAtt
!= null && smtpUserAtt
.Value
!= String
.Empty
)
52 username
= smtpUserAtt
.Value
;
54 if (smtpPwdAtt
!= null && smtpPwdAtt
.Value
!= String
.Empty
)
56 password
= smtpPwdAtt
.Value
;
61 /// Gets or sets the smtp host.
63 /// <value>The host.</value>
71 /// Gets or sets the smtp port.
73 /// <value>The port.</value>
81 /// Gets or sets the smtp username.
83 /// <value>The username.</value>
84 public String Username
86 get { return username; }
87 set { username = value; }
91 /// Gets or sets the smtp password.
93 /// <value>The password.</value>
94 public String Password
96 get { return password; }
97 set { password = value; }