How to add attachements to new outlook programmatically?
Default Mail App – is New Outlook
Do you have any ideas to add attachement to new outlook ?
We use the following code :
protected async void SendMail(Email mail)
{
try
{
var emailMessage = new Windows.ApplicationModel.Email.EmailMessage();
emailMessage.AllowInternetImages = true;
emailMessage.To.Add(new Windows.ApplicationModel.Email.EmailRecipient(mail.Destinataire));
emailMessage.Subject = mail.Sujet;
emailMessage.Body = mail.Corps;
var stream = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(mail.fichier);
var attachment = new Windows.ApplicationModel.Email.EmailAttachment(fichier.Name, stream);
emailMessage.Attachments.Add(attachment);
await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage);
}
catch (Exception ex)
{
}
}
Regards,
Thibaud
Hello, We have developped C# UWP application that send an email with attachement file through Courier app and its work fine). Our customers migrate from Courier to New Outlook and our programs still open New Outlook mail message with Recipient, Subject, and body, but attachement files not appears !Default Mail App – is New OutlookDo you have any ideas to add attachement to new outlook ?We use the following code : protected async void SendMail(Email mail)
{
try
{
var emailMessage = new Windows.ApplicationModel.Email.EmailMessage();
emailMessage.AllowInternetImages = true;
emailMessage.To.Add(new Windows.ApplicationModel.Email.EmailRecipient(mail.Destinataire));
emailMessage.Subject = mail.Sujet;
emailMessage.Body = mail.Corps;
var stream = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(mail.fichier);
var attachment = new Windows.ApplicationModel.Email.EmailAttachment(fichier.Name, stream);
emailMessage.Attachments.Add(attachment);
await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage);
}
catch (Exception ex)
{
}
} Regards,Thibaud Read More