Tout en essayant d'ouvrir Outlook pour la pièce jointe dans le courrier, via le site Web IIS asp.net a cette erreur. Affectez IIS USR et le réseau avec des autorisations complètes dans DCOMCnfg au composant Microsoft OutLook mais rien ne fonctionne.La récupération de la fabrique de classe COM pour le composant a échoué. L'accès est refusé. HRESULT: 0x80070005 E_ACCESSDENIED
La récupération de la fabrique de classe COM pour le composant avec CLSID {0006F03A-0000-0000-C000-000000000046} a échoué en raison de l'erreur suivante: 80070005 L'accès est refusé. (Exception de HRESULT: 0x80070005 (E_ACCESSDENIED)).
using System;
using Outlook = Microsoft.Office.Interop.Outlook;
// Create the Outlook application.
Outlook.Application oApp = new Outlook.Application();
// Create a new mail item.
Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
// Set HTMLBody.
//add the body of the email
oMsg.HTMLBody = "Hello, This is test for sending pdf attachment using OutLook";
//Add an attachment.
String sDisplayName = "MyAttachment";
int iPosition = (int)oMsg.Body.Length + 1;
int iAttachType = (int)Outlook.OlAttachmentType.olByValue;
//now attached the file
Outlook.Attachment oAttach = oMsg.Attachments.Add(Server.MapPath("~/TestSendFile.pdf"), iAttachType, iPosition, sDisplayName);
//Subject line
oMsg.Subject = "Your Subject will go here.";
// Add a recipient.
Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients;
// Change the recipient in the next line if necessary.
Outlook.Recipient oRecip = (Outlook.Recipient)oRecips.Add("[email protected]");
oRecip.Resolve();
// Send.
oMsg.Display();
HI Dmitry, pouvez-vous s'il vous plaît me montrer un exemple de travail ou un lien avec elle? J'essaye ceci sur mon emplacement de localhost et assigné chaque droit possible mais même erreur. Serait très reconnaissant si c'est possible. – Ammad
Exemple de quoi? Laquelle des 6 options ci-dessus? –