Angeben eines Internetcodierungsschemas für den Text und die Anlagen einer Nachricht
In diesem Thema wird gezeigt, wie Sie die MAPI-Eigenschaft PidTagInternetMailOverrideFormat und das Microsoft Outlook-Objektmodell verwenden, um ein Internetcodierungsschema für den Exchange Internet Mail Service (IMS) anzugeben, um den Text und die Anlagen eines E-Mail-Elements zu codieren.
Das folgende Codebeispiel in Visual C# zeigt, wie Sie auf PidTagInternetMailOverrideFormat mit seinem MAPI-proptag-Namespace verweisen und das PropertyAccessor-Objekt des Outlook-Objektmodells verwenden, um MIME als Internetcodierungsschema für eine Nachricht anzugeben. PidTagInternetMailOverrideFormat wird wie folgt referenziert:
https://schemas.microsoft.com/mapi/proptag/0x59020003
dabei 0x59020003
ist das Proptag von PidTagInternetMailOverrideFormat.
private void SendMail_Click()
{
Outlook.NameSpace objSession;
Outlook.MailItem objMailItem;
Outlook.Recipient objRecipient;
Outlook.PropertyAccessor oPA;
string Recipient, MsgSubject, ImageFile, TextFile, FileLocation, PropName;
int EncodingFlag;
//Modify the following to appropriate values.
Recipient = "someone@example.com";
EncodingFlag = 1; //Use MIME encoding
MsgSubject = "Test Encoding";
ImageFile = "garden.jpg";
TextFile = "mytext.txt";
FileLocation = "c:\\";
objSession = Application.GetNamespace("MAPI");
objSession.Logon(null, null, true, null);
objMailItem = Application.CreateItem(
Outlook.OlItemType.olMailItem) as Outlook.MailItem;
objMailItem.Subject = MsgSubject;
objMailItem.Body = "body";
objMailItem.Attachments.Add(FileLocation + TextFile,
Outlook.OlAttachmentType.olByValue, 1, TextFile);
objMailItem.Attachments.Add(FileLocation + ImageFile,
Outlook.OlAttachmentType.olByValue, 1, ImageFile);
objRecipient = objMailItem.Recipients.Add(Recipient);
objRecipient.Resolve();
PropName = "https://schemas.microsoft.com/mapi/proptag/0x59020003";
oPA = objMailItem.PropertyAccessor;
oPA.SetProperty(PropName, EncodingFlag);
objMailItem.Send();
objSession.Logoff();
}
Support und Feedback
Haben Sie Fragen oder Feedback zu Office VBA oder zu dieser Dokumentation? Unter Office VBA-Support und Feedback finden Sie Hilfestellung zu den Möglichkeiten, wie Sie Support erhalten und Feedback abgeben können.
Feedback
https://aka.ms/ContentUserFeedback.
Bald verfügbar: Im Laufe des Jahres 2024 werden wir GitHub-Issues stufenweise als Feedbackmechanismus für Inhalte abbauen und durch ein neues Feedbacksystem ersetzen. Weitere Informationen finden Sie unterFeedback senden und anzeigen für