Dateianhänge in Mails mit MAPI

mirage228

Mitglied
Also ich wollte in meinem Programm Texte als Anlage per EMail verschicken können. Ich komme aber mit lpFiles vom Typ PMapiFileDesc net klar! Wie soll man den definieren.

Der Hilfedatei auszug ist leider nur für C++:
typedef struct {
ULONG ulReserved;
ULONG flFlags;
ULONG nPosition;
LPTSTR lpszPathName;
LPTSTR lpszFileName;
LPVOID lpFileType;
} MapiFileDesc, FAR *lpMapiFileDesc;


Members

ulReserved

Reserved; must be zero.

flFlags

Bitmask of attachment flags. The following flags can be set:

MAPI_OLE

Indicates the attachment is an OLE object file attachment. If MAPI_OLE_STATIC is also set, the object is static. If neither flag is set, the attachment is simply a data file.

MAPI_OLE_STATIC

Set to iIndicates a static OLE object file attachment.

nPosition

Integer used in the MapiMessage structure member lpszNoteText to indicate at which character the attachment should be rendered in the message body. The application renders an attachment within the message text at the character and offset designated by lpszNoteText[nPosition] in MapiMessage. A value of - 1 (0xFFFFFFFF) means attachment position is not indicated in this way.

lpszPathName

Pointer to the fully qualified path of the attachment file. This path should include the disk drive letter and directory name.

lpszFileName

Optional pointer to the attachment filename seen by the recipient, which may differ from the filename in the lpszPathName member if temporary files are being used. If the lpszFileName member is empty or NULL, the filename from lpszPathName is used.

lpFileType

Optional pointer to a descriptor that can be used to indicate to message recipients the type of the attached file; an example is a filename extension such as .DOC. A value of NULL indicates an unknown or operating system-
determined file type.

---

Quellcode in meinem Programm: [das was da steht hab ich grösstenteils aus ner Delphi Demo kopiert]

procedure TMain.SendBtnClick(Sender: TObject);
var
MapiMessage: TMapiMessage;
MError: Cardinal;
begin
with MapiMessage do
begin
ulReserved := 0;
lpszSubject := nil;
lpszNoteText := nil;
lpszMessageType := nil;
lpszDateReceived := nil;
lpszConversationID := nil;
flFlags := 0;
lpOriginator := nil;
nRecipCount := 0;
lpRecips := nil;
nFileCount := 0;
lpFiles := nil; // Was muss man hier schreiben???
end;

MError := MapiSendMail(0, 0, MapiMessage,
MAPI_DIALOG or MAPI_LOGON_UI or MAPI_NEW_SESSION, 0);
if MError <> 0 then Application.MessageBox('Nachrichtenerstellung beendet.','Warnung',48);
end;


---
Kann mir einer Helfen?
thx, mirage228
 
Wieso muss das denn mit MAPI sein? Nimm doch einfach die Komponenten von Indy oder die von FastNet. Da sind schon fertige Mail-Client-Komponenten mit drin.
 
Original geschrieben von asphyxia
Wieso muss das denn mit MAPI sein? Nimm doch einfach die Komponenten von Indy oder die von FastNet. Da sind schon fertige Mail-Client-Komponenten mit drin.

Sag mir, wie man das in
Delphi 3 Professional von 1997
macht und ich werf MAPI in den Müll :)
 
Zuletzt bearbeitet:
Guck mal im VB-Forum nach "Emails mit Anhang verschicken" oder so. Da hab ich mal gepostet, wie man mit den üblichen MAPI-Funktionen Emails versenden kann. Unter Delphi müsste das genauso (oder so ähnlich) gehen, Du musst halt einfach nur die Funktionen aus der entsprechenden DLL aufrufen.
Allerdings verzichtest Du dabei auf jegliche Form von OOP.
 
Also mit Delphi 4 konnte ich damals schon die Indy-Komponenten benutzen. Und das war schon Indy 8 (glaub ich), vorher hiessen die Winshoes.
Also sollte das mit Delphi 3 eigentlich auch gehen. Ansonsten gibts ja auch noch FastNet und einige andere bei Torry. Aber so extrem viel ändert sich bei Delphi ja eh nicht wirklich. ;)
 
Ich habe früher selber noch die Winshoes-Komponenten benutzt.

Und in der Quelle steht ja auch, dass dieser in Delphi 3 auch laufen - FastNet war zu dem Zeitpunkt ja allerdings noch nicht erfunden. :)
 
Zurück