Message was not sent to recipient

H

hash

Hello.

"Message was not sent to recipient"

I got this message when trying to send email from my AddIn. I am not
using Exchange, just a smtp.
This is my code for sending.

NS.Logon(null, null, true, true);
Outlook.MAPIFolder oOutboxFolder =
NS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderOutbox);
Outlook._MailItem oMailItem =
(Outlook._MailItem)application.CreateItem(Outlook.OlItemType.olMailItem);
Outlook.Recipient oRecip =
(Outlook.Recipient)oMailItem.Recipients.Add(Settings.Default.Email);
oRecip.Resolve();

oMailItem.Subject = "Calendar events for: ";
oMailItem.Body = builder.ToString();
oMailItem.SaveSentMessageFolder = oOutboxFolder;
oMailItem.Save();
oMailItem.Send();
 
K

Ken Slovak - [MVP - Outlook]

This is an Outlook addin? Don't do a logon to NameSpace if that's the case.
Just initialize the NameSpace object using GetNameSpace("MAPI")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top