Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

CanSendMail Property

.NET Framework 1.1

Returns true if the device or browser supports sending mail through the mailto scheme for electronic mail addresses. The default value is true.

public virtual bool CanSendMail {
   get
}

Example

The following example demonstrates how to use the CanSendMail property.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   
   Dim currentCapabilities As MobileCapabilities =  CType(Request.Browser, MobileCapabilities)
   If currentCapabilities.CanSendMail Then
      Link1.Text = "Mail Us"
      Link1.NavigateUrl = "mailto:someone@example.com"
   Else
      Link1.Text = "No mail support"
      Link1.NavigateUrl = "#Form1"
   End If

End Sub

[C#]
public void Page_Load(Object sender, EventArgs e)
{
   MobileCapabilities currentCapabilities
      = (MobileCapabilities)Request.Browser;
   if (currentCapabilities.CanSendMail)
   {
      Link1.Text = "Mail Us";
      Link1.NavigateUrl= "mailto:someone@example.com";
   }
   else
   {
      Link1.Text = "No mail support";
      Link1.NavigateUrl = "#Form1";
   }
}

See Also

Applies to: MobileCapabilities Class

Show:
© 2015 Microsoft