We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unable to send aspose created email from Outlook

Hi,

We are having an issue whereby we create a MapiMessage from an existing .msg file and set the subject line. That file is saved back to the filesystem and then open Outlook via Process.Start(msg file).

Outlook opens OK and displays the message OK. We then enter the ‘To’ address manually and add anything else to the body that the user might want to - all good.

But when we press Send, we get a Microsoft Outlook message stating ‘Could not complete the operation because the service provider does not support it’. There are no errors in the event log to shed more light on this. I am assuming that doing it this way, the ‘from’ is already set and determined via my outlook account, but I also tried setting ‘SenderEmailAddress’ and ‘SenderName’ and that made no difference.

The .msg file we use as a template for creating the message was create from inside Outlook by just clicking ‘New Email’. That message is then saved to a folder by click ‘File > Save As’ on the email and then setting the path.

I should note that this Outlook inbox is coming from a google-synced google mail account and I am using Outlook 365 (have also tested on other versions of Outlook). Perhaps we can’t use the MapiMessage type for this?

See the code below:
var mailMessage = MapiMessage.FromFile(@“c:\temp\template.msg”);
mailMessage.Subject = “My subject”;
string outputMsg = @“c:\temp\output.msg”;

using (var msgStream = new FileStream(outputMsg, FileMode.Create, FileAccess.ReadWrite))
{
mailMessage.Save(msgStream);
}

System.Diagnostics.Process.Start(outputMsg);

We were using Aspose.Email v16.12.0.0 but have also tried the same test in v18.9.0.0 and get the same results.

I also tried create the email from scratch using aspose.email instead of using the presaved file but that also failed.

Any help appreciated.

@Gleedo,

You may use the code snippet given below to generate MSG file.

MailMessage mailMessage = new MailMessage();
mailMessage.Subject = "My Subject";
mailMessage.Body = "Email Body";
MapiMessage mapiMessage = MapiMessage.FromMailMessage(mailMessage);
mapiMessage.Save("TestEmail.msg", MsgSaveOptions.DefaultMsg);

We hope that this fixed the issue that you were facing. Please feel free to contact us if additional information is required.

Hello, thank you for the swift reply.

I have tried the sample above and I am still seeing the same error when trying to send the email:
“Could not complete the operation because the service provider does not support it.”

@Gleedo,

Can you please elaborate on this further? Are you referring to the Gmail account connected via IMAP in Outlook?

Can you please elaborate on this further? Are you referring to the Gmail account connected via IMAP in Outlook?

Our work email addresses are business google email accounts. In order to use Outlook with these gmail accounts, we use Google G Suite to sync emails down to Outlook. Info on that can be found here:
Google G Suite Sync for Outlook

If in Outlook I look at my account settings, It says the email type is ‘Mapi’ and they are stored in a local .pst file.

@Gleedo,

We searched this exception on the internet. This seems to be an integration issue between Outlook and Google G Suite for Outlook. You may do this additional test. Create a MSG file on an Outlook configured differently. Bring over this file and try sending it without modifying it using Aspose.Email.
Please feel free to reach us if additional information is required.