1

I want to send an email via my UWP 10 app. here is the code i used but i get nothing and the project crashes (I don't know what to put in the xaml page also)

private async void SendEmailButton_Click(object sender, RoutedEventArgs e)
{
    EmailMessage emailMessage = new EmailMessage();
    emailMessage.To.Add(new EmailRecipient("***@***.com"));
    string messageBody = "Hello World";
    emailMessage.Body = messageBody;
    await EmailManager.ShowComposeNewEmailAsync(emailMessage);
}

PS: i don't need to send an attachement in my email that what i get in the debugger

'EmailTest1.exe' (CoreCLR: DefaultDomain): Loaded 'C:\data\Programs\WindowsApps\Microsoft.NET.CoreRuntime.1.0_1.0.23430.0_x86__8wekyb3d8bbwe\mscorlib.ni.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\entrypoint\EmailTest1.exe'. Symbols loaded. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Runtime.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\WinMetadata\Windows.winmd'. Module was built without symbols. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Runtime.InteropServices.WindowsRuntime.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\Microsoft.ApplicationInsights.Extensibility.Windows.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Threading.Tasks.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTo.X\Microsoft.ApplicationInsights.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Runtime.WindowsRuntime.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Diagnostics.Debug.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Runtime.WindowsRuntime.UI.Xaml.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Collections.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Private.Uri.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\Microsoft.ApplicationInsights.PersistenceChannel.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Threading.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Diagnostics.Tracing.dll'. Module was built without symbols. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Linq.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.IO.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Globalization.dll'. Module was built without symbols. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Runtime.Extensions.dll'. Cannot find or open the PDB file. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Reflection.dll'. Module was built without symbols. 'EmailTest1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\dc12aef2-b53e-4795-a606-9afcd5298032VS.Debug_x86.X\System.Reflection.Extensions.dll'. Module was built without symbols. The thread 0xd84 has exited with code 0 (0x0). The thread 0xc6c has exited with code 0 (0x0).

THANK YOU

Priya
  • 1,359
  • 6
  • 21
  • 41
hilary duff
  • 101
  • 1
  • 1
  • 12
  • Well, I'm going to assume you're actually specifying an email recipient, not what you're showing here. But what's the exception? That should tell you what's going wrong. – Clockwork-Muse Apr 01 '16 at 01:37
  • OK. What does the debugger tell you when you step through the code? On what line does it crash? What variables are on that line? What is the content of those variables just before the line is executed? – Ken White Apr 01 '16 at 01:41
  • of course i changed the recipient address .. please check the update to see what i got in the debugger .. Ps : i think i might have a mistake in the xaml code – hilary duff Apr 01 '16 at 03:09
  • It's not code errors, it's messages telling you that there are no symbol (.pdb) files for the DLL's loaded by your app. Please try to update your VS tool. Or you can check this [case on SO](http://stackoverflow.com/questions/15937707/error-message-cannot-find-or-open-the-pdb-file). – Grace Feng Apr 01 '16 at 05:29

1 Answers1

1
private async void SendEmailButton_Click(object sender, RoutedEventArgs e)
{
EmailMessage emailMessage = new EmailMessage();
emailMessage.To.Add(new EmailRecipient("***@***.com"));
string messageBody = "Hello World";
emailMessage.Body = messageBody;
await EmailManager.ShowComposeNewEmailAsync(emailMessage);
}

The above works only with Windows 8.1 apps, it has been remoeved from the Win 10 Universal SDK, To Send an Email in Windows 10 from your application, you can directly get connected to your outlook app on your phone. To do so you have to use In your sendemail_click event write like this

DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
dataTransferManager.DataRequested+=DataRequested;
DataTransferManager.ShowShareUI();

private void DataRequested(DataTransferManager sender,DataRequestedEventArgs e)
{
    DataRequest request = e.Request;
    request.Data.Properties.Title = "Share Text Example";
    request.Data.Properties.Description = "An example of how to share text.";
    request.Data.SetText("Hello World!");
}
userhi
  • 553
  • 1
  • 7
  • 27