1 // Copyright 2004-2007 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
18 using System
.Text
.RegularExpressions
;
21 /// MonoRail constants
23 static class Constants
25 #region Controller Constants
28 /// TODO: Document why this is necessary
30 public static readonly String ControllerContextKey
= "rails.controller";
33 /// TODO: Document why this is necessary
35 internal static readonly String OriginalViewKey
= "rails.original_view";
39 #region Email Constants
41 public const String To
= "to";
42 public const String Cc
= "cc";
43 public const String Bcc
= "bcc";
45 public static readonly String EmailTemplatePath
= "mail";
46 public static readonly String ToAddressPattern
= @"[ \t]*(?<header>(to|cc|bcc)):[ \t]*(?<value>([\w-\.]+@([\w\.]){1,}\w+[ \t]*[,;]?[ \t]*)+)[ \t]*(\r*\n*)?";
47 public static readonly String FromAddressPattern
= @"[ \t]*from:[ \t]*(?<value>(\w+[ \t]*)*<*[ \t]*[\w-\.]+@([\w\.]){1,}[\w][ \t]*>*)[ \t]*(\r*\n*)?";
48 public static readonly String HeaderPattern
= @"[ \t]*(?<header>(subject|X-\w+)):[ \t]*(?<value>(\w+[ \t]*)+)(\r*\n*)?";
49 public static readonly String HeaderKey
= "header";
50 public static readonly String ValueKey
= "value";
51 public static readonly String Subject
= "subject";
52 public static readonly String HtmlTag
= "<html>";
53 public static readonly String SmtpUsername
= "SMTP_USERNAME";
54 public static readonly String SmtpPassword
= "SMTP_PASSWORD";
55 public static readonly String SmtpUsernameSchema
= "http://schemas.microsoft.com/cdo/configuration/sendusername";
56 public static readonly String SmtpPasswordSchema
= "http://schemas.microsoft.com/cdo/configuration/sendpassword";
57 public static readonly String SmtpAuthSchema
= "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate";
58 public static readonly String SmtpAuthEnabled
= "1";
59 public static readonly String SmtpServer
= "SMTP_SERVER";
60 public static readonly String DefaultSmtpServer
= "localhost";
62 public static readonly Regex readdress
= new Regex(ToAddressPattern
, RegexOptions
.IgnoreCase
| RegexOptions
.Compiled
);
63 public static readonly Regex refrom
= new Regex(FromAddressPattern
, RegexOptions
.IgnoreCase
| RegexOptions
.Compiled
);
64 public static readonly Regex reheader
= new Regex(HeaderPattern
, RegexOptions
.IgnoreCase
| RegexOptions
.Compiled
);