Compose Email

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Compose Email

Postby JS-Support @Userware » Mon Apr 11, 2016 8:39 am

Hi,

Please find below the code for composing a new email from within your app (this will cause the default mail application to open with the specified recipient address, subject, and body):

(Requires beta 7.2 or newer)

Code: Select all

public static void ComposeEmail(string recipientEmailAddress, string emailSubject, string emailBody)
{
    if (!CSHTML5.Interop.IsRunningInTheSimulator)
    {
        CSHTML5.Interop.ExecuteJavaScript("location.href = 'mailto: ' + $0 + '?subject=' + $1 + '&body=' + $2", recipientEmailAddress, emailSubject, emailBody);
    }
    else
    {
        System.Windows.MessageBox.Show("Composing an email is not supported inside the Simulator. Please run the final application instead.");
    }
}}


Regards,
JS-Support

Return to “Extensions and Plugins for CSHTML5”

Who is online

Users browsing this forum: No registered users and 2 guests