Send (WebMail Ref)

The send property is the main method in WebMail Class. It can take 13 arguments, however only 3 are compulsory.

Syntax

WebMail.Send(to, subject, message)

Example

@{
string message = "Hello this is a test";
string msg = "";
 
try
{
 WebMail.Send("[email protected]", "This is a test", message, isBodyHtml:true);   
}
catch (Exception ex)
{
    msg = ex.Message.ToString();
}
 
}

Always place your send method in a try catch block because an error can occur any time.  The IsBodyHtml is optional, however if you want your message to be encoded in HTML  it needs to be set to true.