MarekMailSystem2.Email Class Reference

Email class represents an e-mail. It has properties like: From, To, Subject, Body etc. To send an e-mail, pass an instance of this class to SmtpEmailClient.Send(Email) method. String properties with email adresses can contain display name like here: "display name &lt;user@host&gt;" . You variables like $FOO in email properties to create email template. Then you can use Email.ProcessTemplate(Directory<string,string> context) to get email with variables like $FOO changed to context[FOO] . More...

Collaboration diagram for MarekMailSystem2.Email:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Email ()
 Email (string from, string to, string subject, string body)
 Email (string to, string subject, string body)
 Constructs an email. In this constructor version, The Email object will get the From address from configuration file, when Email is send.
void ProcessTemplate (Dictionary< string, string > context)
 Modifies email string properties so everywhere there a variable like $FOO, it will be replaced by context["FOO"] .
override string ToString ()

Static Public Member Functions

static string GetHtmlFromText (string text)
static string GetTextFromHtml (string html)

Properties

DateTime SendingTime [get, set]
 Gets last sending time (even if there was a failure). If email is scheduled to send in the future, then SendingTime keeps the time when email should be send.
EmailStatus SendingStatus [get, set]
 Gets the email sending status. See EmailStatus class for details.
string From [get, set]
 Gets or sets the from address for this e-mail message.
string To [get, set]
 Gets or sets the address that contains the recipient of this e-mail message.
string Cc [get, set]
 Gets or sets the address that contains the carbon copy (CC) recipient of this e-mail message.
string Bcc [get, set]
 Gets or sets the address that contains the blind carbon copy (BCC) recipient of this e-mail message.
string ReplyTo [get, set]
 Gets or sets the ReplyTo address for the mail message.
string Sender [get, set]
 Gets or sets the sender's address for the mail message.
List< string > FileAttachments [get]
string Subject [get, set]
 Gets or sets the subject line for this e-mail message.
string Body [get, set]
 Gets or sets the message body.
bool IsBodyHtml [get, set]
 Gets or sets a value indicating whether the mail message body is in Html format (or plain text).
bool AltView [get, set]
 Gets or sets a value indicating whether the email should have generated alternate view (html or text). If the body is the html it will generate the plain text and vice versa.
MailPriority Priority [get, set]
 Gets or sets email priority.

Private Member Functions

internal MailMessage ConstructMailMessage ()
void cnvStringToMailAddressCollection (string s, MailAddressCollection c)

Private Attributes

DateTime sendingTime
EmailStatus sendingStatus = new EmailStatus()
string from
string to
string cc
string bcc
string replyTo
string sender
List< string > fileAttachments = new List<string>()
string subject = ""
string body = ""
bool isBodyHtml
bool altView = true
MailPriority priority = MailPriority.Normal

Static Private Attributes

static TemplateEngine engine = new TemplateEngine(true)


Detailed Description

Email class represents an e-mail. It has properties like: From, To, Subject, Body etc. To send an e-mail, pass an instance of this class to SmtpEmailClient.Send(Email) method. String properties with email adresses can contain display name like here: "display name &lt;user@host&gt;" . You variables like $FOO in email properties to create email template. Then you can use Email.ProcessTemplate(Directory<string,string> context) to get email with variables like $FOO changed to context[FOO] .

Definition at line 34 of file Email.cs.


Constructor & Destructor Documentation

MarekMailSystem2.Email.Email (  ) 

Definition at line 36 of file Email.cs.

MarekMailSystem2.Email.Email ( string  from,
string  to,
string  subject,
string  body 
)

Definition at line 39 of file Email.cs.

References MarekMailSystem2.Email.Body, MarekMailSystem2.Email.From, MarekMailSystem2.Email.Subject, and MarekMailSystem2.Email.To.

MarekMailSystem2.Email.Email ( string  to,
string  subject,
string  body 
)

Constructs an email. In this constructor version, The Email object will get the From address from configuration file, when Email is send.

Definition at line 52 of file Email.cs.

References MarekMailSystem2.Email.Body, MarekMailSystem2.Email.Subject, and MarekMailSystem2.Email.To.


Member Function Documentation

void MarekMailSystem2.Email.ProcessTemplate ( Dictionary< string, string >  context  ) 

Modifies email string properties so everywhere there a variable like $FOO, it will be replaced by context["FOO"] .

Parameters:
context dictonary of variable values

Definition at line 227 of file Email.cs.

References MarekMailSystem2.Email.Bcc, MarekMailSystem2.Email.Body, MarekMailSystem2.Email.Cc, MarekMailSystem2.Email.engine, MarekMailSystem2.Email.From, MarekMailSystem2.TemplateEngine.Process(), MarekMailSystem2.Email.ReplyTo, MarekMailSystem2.Email.Sender, MarekMailSystem2.Email.Subject, and MarekMailSystem2.Email.To.

Referenced by MarekMailSystem2Tests.NormalTests.EmailTemplateTest1(), and MarekMailSystem2Tests.NormalTests.EmailTemplateTest2().

override string MarekMailSystem2.Email.ToString (  ) 

Definition at line 241 of file Email.cs.

References MarekMailSystem2.Email.AltView, MarekMailSystem2.Email.Bcc, MarekMailSystem2.Email.Body, MarekMailSystem2.Email.Cc, MarekMailSystem2.Email.FileAttachments, MarekMailSystem2.Email.From, MarekMailSystem2.Email.IsBodyHtml, MarekMailSystem2.Email.Priority, MarekMailSystem2.Email.ReplyTo, MarekMailSystem2.Email.Sender, MarekMailSystem2.Email.SendingStatus, MarekMailSystem2.Email.SendingTime, MarekMailSystem2.Email.Subject, and MarekMailSystem2.EmailStatus.ToString().

internal MailMessage MarekMailSystem2.Email.ConstructMailMessage (  )  [private]

Definition at line 268 of file Email.cs.

References MarekMailSystem2.Email.AltView, MarekMailSystem2.Email.Bcc, MarekMailSystem2.Email.Body, MarekMailSystem2.Email.Cc, MarekMailSystem2.Email.cnvStringToMailAddressCollection(), MarekMailSystem2.Email.FileAttachments, MarekMailSystem2.Email.From, MarekMailSystem2.Email.GetHtmlFromText(), MarekMailSystem2.Email.GetTextFromHtml(), MarekMailSystem2.Email.IsBodyHtml, MarekMailSystem2.Email.Priority, MarekMailSystem2.Email.ReplyTo, MarekMailSystem2.Email.Sender, MarekMailSystem2.Email.Subject, and MarekMailSystem2.Email.To.

Referenced by MarekMailSystem2.SmtpEmailSender.Send().

void MarekMailSystem2.Email.cnvStringToMailAddressCollection ( string  s,
MailAddressCollection  c 
) [private]

Definition at line 309 of file Email.cs.

Referenced by MarekMailSystem2.Email.ConstructMailMessage().

static string MarekMailSystem2.Email.GetHtmlFromText ( string  text  )  [static]

Definition at line 317 of file Email.cs.

Referenced by MarekMailSystem2.Email.ConstructMailMessage().

static string MarekMailSystem2.Email.GetTextFromHtml ( string  html  )  [static]

Definition at line 333 of file Email.cs.

Referenced by MarekMailSystem2.Email.ConstructMailMessage().


Member Data Documentation

DateTime MarekMailSystem2.Email.sendingTime [private]

Definition at line 60 of file Email.cs.

EmailStatus MarekMailSystem2.Email.sendingStatus = new EmailStatus() [private]

Definition at line 72 of file Email.cs.

string MarekMailSystem2.Email.from [private]

Definition at line 84 of file Email.cs.

string MarekMailSystem2.Email.to [private]

Definition at line 95 of file Email.cs.

string MarekMailSystem2.Email.cc [private]

Definition at line 107 of file Email.cs.

string MarekMailSystem2.Email.bcc [private]

Definition at line 118 of file Email.cs.

string MarekMailSystem2.Email.replyTo [private]

Definition at line 129 of file Email.cs.

string MarekMailSystem2.Email.sender [private]

Definition at line 141 of file Email.cs.

List<string> MarekMailSystem2.Email.fileAttachments = new List<string>() [private]

Definition at line 152 of file Email.cs.

string MarekMailSystem2.Email.subject = "" [private]

Definition at line 160 of file Email.cs.

string MarekMailSystem2.Email.body = "" [private]

Definition at line 172 of file Email.cs.

bool MarekMailSystem2.Email.isBodyHtml [private]

Definition at line 184 of file Email.cs.

bool MarekMailSystem2.Email.altView = true [private]

Definition at line 195 of file Email.cs.

MailPriority MarekMailSystem2.Email.priority = MailPriority.Normal [private]

Definition at line 209 of file Email.cs.

TemplateEngine MarekMailSystem2.Email.engine = new TemplateEngine(true) [static, private]

Definition at line 220 of file Email.cs.

Referenced by MarekMailSystem2.Email.ProcessTemplate().


Property Documentation

DateTime MarekMailSystem2.Email.SendingTime [get, set]

Gets last sending time (even if there was a failure). If email is scheduled to send in the future, then SendingTime keeps the time when email should be send.

Definition at line 67 of file Email.cs.

Referenced by MarekMailSystem2.SmtpEmailSender.Send(), and MarekMailSystem2.Email.ToString().

EmailStatus MarekMailSystem2.Email.SendingStatus [get, set]

Gets the email sending status. See EmailStatus class for details.

Definition at line 78 of file Email.cs.

Referenced by MarekMailSystem2SimpleWinUI.FormMarekMailSystem2SimpleWinUI.buttonSend_Click(), MarekMailSystem2Tests.NormalTests.EmailAltViewTest1(), MarekMailSystem2.SmtpEmailSender.Send(), MarekMailSystem2.EmailSender.Send(), MarekMailSystem2.EmailManager.Send(), MarekMailSystem2.EmailSender.SendTemplate(), MarekMailSystem2Tests.NormalTests.SmtpEmailSenderTest1(), MarekMailSystem2Tests.NormalTests.SmtpEmailSenderTest2(), and MarekMailSystem2.Email.ToString().

string MarekMailSystem2.Email.From [get, set]

Gets or sets the from address for this e-mail message.

Definition at line 89 of file Email.cs.

Referenced by MarekMailSystem2.Email.ConstructMailMessage(), MarekMailSystem2.Email.Email(), MarekMailSystem2.Email.ProcessTemplate(), and MarekMailSystem2.Email.ToString().

string MarekMailSystem2.Email.To [get, set]

Gets or sets the address that contains the recipient of this e-mail message.

Definition at line 101 of file Email.cs.

Referenced by MarekMailSystem2.Email.ConstructMailMessage(), MarekMailSystem2.Email.Email(), and MarekMailSystem2.Email.ProcessTemplate().

string MarekMailSystem2.Email.Cc [get, set]

Gets or sets the address that contains the carbon copy (CC) recipient of this e-mail message.

Definition at line 113 of file Email.cs.

Referenced by MarekMailSystem2SimpleWinUI.FormMarekMailSystem2SimpleWinUI.buttonSend_Click(), MarekMailSystem2.Email.ConstructMailMessage(), MarekMailSystem2.Email.ProcessTemplate(), and MarekMailSystem2.Email.ToString().

string MarekMailSystem2.Email.Bcc [get, set]

Gets or sets the address that contains the blind carbon copy (BCC) recipient of this e-mail message.

Definition at line 124 of file Email.cs.

Referenced by MarekMailSystem2SimpleWinUI.FormMarekMailSystem2SimpleWinUI.buttonSend_Click(), MarekMailSystem2.Email.ConstructMailMessage(), MarekMailSystem2.Email.ProcessTemplate(), and MarekMailSystem2.Email.ToString().

string MarekMailSystem2.Email.ReplyTo [get, set]

Gets or sets the ReplyTo address for the mail message.

Definition at line 135 of file Email.cs.

Referenced by MarekMailSystem2.Email.ConstructMailMessage(), MarekMailSystem2.Email.ProcessTemplate(), and MarekMailSystem2.Email.ToString().

string MarekMailSystem2.Email.Sender [get, set]

Gets or sets the sender's address for the mail message.

Definition at line 147 of file Email.cs.

Referenced by MarekMailSystem2.Email.ConstructMailMessage(), MarekMailSystem2.Email.ProcessTemplate(), and MarekMailSystem2.Email.ToString().

List<string> MarekMailSystem2.Email.FileAttachments [get]

Definition at line 154 of file Email.cs.

Referenced by MarekMailSystem2SimpleWinUI.FormMarekMailSystem2SimpleWinUI.buttonSend_Click(), MarekMailSystem2.Email.ConstructMailMessage(), and MarekMailSystem2.Email.ToString().

string MarekMailSystem2.Email.Subject [get, set]

Gets or sets the subject line for this e-mail message.

Definition at line 166 of file Email.cs.

Referenced by MarekMailSystem2.Email.ConstructMailMessage(), MarekMailSystem2.Email.Email(), MarekMailSystem2.Email.ProcessTemplate(), and MarekMailSystem2.Email.ToString().

string MarekMailSystem2.Email.Body [get, set]

Gets or sets the message body.

Definition at line 178 of file Email.cs.

Referenced by MarekMailSystem2.Email.ConstructMailMessage(), MarekMailSystem2.Email.Email(), MarekMailSystem2Tests.NormalTests.EmailAltViewTest1(), MarekMailSystem2.Email.ProcessTemplate(), and MarekMailSystem2.Email.ToString().

bool MarekMailSystem2.Email.IsBodyHtml [get, set]

Gets or sets a value indicating whether the mail message body is in Html format (or plain text).

Definition at line 190 of file Email.cs.

Referenced by MarekMailSystem2SimpleWinUI.FormMarekMailSystem2SimpleWinUI.buttonSend_Click(), MarekMailSystem2.Email.ConstructMailMessage(), MarekMailSystem2Tests.NormalTests.EmailAltViewTest1(), and MarekMailSystem2.Email.ToString().

bool MarekMailSystem2.Email.AltView [get, set]

Gets or sets a value indicating whether the email should have generated alternate view (html or text). If the body is the html it will generate the plain text and vice versa.

Definition at line 203 of file Email.cs.

Referenced by MarekMailSystem2.Email.ConstructMailMessage(), MarekMailSystem2Tests.NormalTests.EmailAltViewTest1(), and MarekMailSystem2.Email.ToString().

MailPriority MarekMailSystem2.Email.Priority [get, set]

Gets or sets email priority.

Definition at line 215 of file Email.cs.

Referenced by MarekMailSystem2.Email.ConstructMailMessage(), and MarekMailSystem2.Email.ToString().


The documentation for this class was generated from the following file:
Generated on Thu Oct 25 11:32:56 2007 for Marek Mail System by  doxygen 1.5.3-20071008