| Autor |
Beitrag |
Björn karpenstein
      
Beiträge: 96
Windows XP, Linux
D7, K3
|
Verfasst: Do 01.09.05 15:13
Hallo!
Ich soll ein kleines Ticket-System für unsere Supporter zusammenbasteln. Die Supporter verschicken Ihre eMails per Microsoft Outlook.
Normalerweise melden sich die Supporter an und Ihr Outlook ist bereits eingerichtet und empfängt nur die entsprechenden Mails. Gibts da ne einfache Möglichkeit die Mails durchzulaufen ohne Outlook zu öffnen?
|
|
noidic
      
Beiträge: 851
Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
|
Verfasst: Do 01.09.05 15:20
Wo liegen denn die Mails? Auf nem IMAP-Server, POP-Server, Exchange, etc...
Bei IMAP oder POP kannste dir einfach nen eigenen kleinen Mailclient mittels der Indys basteln und die Mails durchgehen.
Bei Exchange wirds komplizierter, da wirste auf MAPI gehen müssen.
_________________ Bravery calls my name in the sound of the wind in the night...
|
|
j-a-n@gmx.de
      
Beiträge: 84
Delphi 7
|
Verfasst: Do 01.09.05 15:32
ich denke mal, dass ein recht einfacher weg über ole/dde/activex, also die programmierschnittstelle von outlook möglich ist.
hab das aber mit delphi noch nicht gemacht, nur mit vb6; da ist es eine leichtigkeit. probiers mal (in delphi7) über Komponente->ActiveX
Die Doku zum Outlook objektmodell findest du hier: msdn.microsoft.com/l...lcome_hv01136199.asp
_________________ --
Dieses Werk ist unter einer Creative Commons 3.0 Lizenz lizenziert und darf unter Namensnennung kopiert, weitergegeben, veröffentlicht und verändert werden.
|
|
jaevencooler
      
Beiträge: 166
Erhaltene Danke: 6
MS-DOS,Win32, Win95, Win 98, Me,XP, Linux, NT4.0, NT 2000-2008, Vista, Windows 7
Turbo Pascal,D1 Enter,D2 Enter,D3 Enter,D5 Enter, Kylix, D2007, PL/SQL, MS/SQL, Delphi 2010, Delphi XE
|
Verfasst: Do 01.09.05 15:48
Moin, Moin,
ich weiß, lange Postings sind verpönnt, aber trotzdem:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267:
| unit Outlook;
interface
uses ComObj, Classes, Dialogs, ActiveX,Sysutils;
function InitOutlook:boolean; function DoneOutlook:boolean;
function AddAppointment (ID,Category,Subject:string; Body:String; StartTime, EndTime:TDateTime; AllDayEvent:boolean):boolean; function DeleteAppointment(ID:string):boolean; function ViewAppointments:boolean; function ViewSendMail:boolean; function ViewOutBox():boolean; function ViewInBox():boolean; function AddEmail(Subject,Adress,CC,BB,Body,FileName : string; DirektSend : boolean):boolean;
implementation
var OutlookExist :boolean;
oleOutlook :OLEVariant; oleNameSpace :OLEVariant;
oleTaskFolder :OLEVariant; oleCalendarFolder :OLEVariant; oleContactFolder :OLEVariant; oleJournalFolder :OLEVariant; oleNotesFolder :OLEVariant; oleSendMailFolder :OleVariant; oleOutboxFolder :OleVariant; oleInBoxFolder :OleVariant;
const
olFolderDeletedItems = 3; olFolderOutbox = 4; olFolderSentMail = 5; olFolderInbox = 6; olFolderCalendar = 9; olFolderContacts = 10; olFolderJournal = 11; olFolderNotes = 12; olFolderTasks = 13;
olMailItem = 0; olAppointmentItem = 1; olContactItem = 2; olTaskItem = 3; olJournalItem = 4; olNoteItem = 5; olPostItem = 6;
olText = 1; olNumber = 3; olDateTime = 5; olYesNo = 6; olDuration = 7; olKeywords = 11; olPercent = 12; olCurrency = 14; olFormula = 18; olCombination = 19;
function InitOutlook:boolean; begin OutlookExist :=FALSE; try Result :=TRUE; CoInitialize(NIL); oleOutlook :=CreateOLEObject('Outlook.Application'); oleNameSpace :=oleOutlook.GetNameSpace('MAPI'); oleTaskFolder :=oleNameSpace.GetDefaultFolder(olFolderTasks); oleCalendarFolder :=oleNameSpace.GetDefaultFolder(olFolderCalendar); oleContactFolder :=oleNameSpace.GetDefaultFolder(olFolderContacts); oleJournalFolder :=oleNameSpace.GetDefaultFolder(olFolderJournal); oleNotesFolder :=oleNameSpace.GetDefaultFolder(olFolderNotes); oleSendMailFolder :=oleNameSpace.GetDefaultFolder(olFolderSentMail); oleOutboxFolder :=oleNameSpace.GetDefaultFolder(olFolderOutbox); oleInBoxFolder :=oleNameSpace.GetDefaultFolder(olFolderInbox); OutlookExist :=TRUE; except MessageDlg('Fehler bei der Initialisierung von Outlook',mtError,[mbOk],0); oleOutlook :=NULL; Result :=FALSE; end; end;
function DoneOutlook():boolean; begin if OutlookExist then try oleOutlook := NULL; except end; Result := TRUE; end;
function AddAppointment(ID,Category,Subject:string; Body:String; StartTime, EndTime:TDateTime; AllDayEvent:boolean):boolean; var Appointment :OLEVariant; UserProp :OLEVariant; begin Result :=TRUE; if not OutlookExist then begin MessageDlg('Die eMail Funktion ist nicht aktiviert. Bitte ändern Sie die Einstellung in den Systemeinstellungen.',mtInformation,[mbOk],0); EXIT; end; try Appointment :=oleOutlook.CreateItem(olAppointmentItem); if AllDayEvent then Appointment.AllDayEvent :=TRUE; AppointMent.Start :=StartTime; AppointMent.End :=EndTime; AppointMent.Subject :=Subject; Appointment.Body :=Body; Appointment.Categories :=Category; UserProp :=AppointMent.UserProperties.Add('PiperID',olText); UserProp.Value :=ID; Appointment.Save; except Result :=FALSE; end; end;
function DeleteAppointment(ID:string):boolean; var AppointmentFolder :OLEVariant; Appointment :OLEVariant; begin Result :=TRUE; if not OutlookExist then begin MessageDlg('Die eMail Funktion ist nicht aktiviert. Bitte ändern Sie die Einstellung in den Systemeinstellungen.',mtInformation,[mbOk],0); EXIT; end; try AppointmentFolder :=oleNameSpace.GetDefaultFolder(olFolderCalendar); Appointment :=AppointmentFolder.Items.Find('[PiperID] = "'+ID+'"'); try Appointment.Delete; except end; except Result :=FALSE; end; end;
function ViewAppointments():boolean; var AppointmentFolder :OLEVariant; begin Result :=TRUE; if not OutlookExist then begin MessageDlg('Die eMail Funktion ist nicht aktiviert. Bitte ändern Sie die Einstellung in den Systemeinstellungen.',mtInformation,[mbOk],0); EXIT; end;
try AppointmentFolder :=oleNameSpace.GetDefaultFolder(olFolderCalendar); AppointmentFolder.Display; except Result :=FALSE; end; end;
function ViewSendMail():boolean; var SendMailFolder :OLEVariant; begin Result :=TRUE; if not OutlookExist then begin MessageDlg('Die eMail Funktion ist nicht aktiviert. Bitte ändern Sie die Einstellung in den Systemeinstellungen.',mtInformation,[mbOk],0); EXIT; end;
try SendMailFolder :=oleNameSpace.GetDefaultFolder(olFolderSentMail); SendMailFolder.Display; except Result :=FALSE; end; end;
function ViewOutBox():boolean; var OutboxFolder :OLEVariant; begin Result :=TRUE; if not OutlookExist then begin MessageDlg('Die eMail Funktion ist nicht aktiviert. Bitte ändern Sie die Einstellung in den Systemeinstellungen.',mtInformation,[mbOk],0); EXIT; end;
try OutboxFolder :=oleNameSpace.GetDefaultFolder(olFolderOutbox); OutboxFolder.Display; except Result :=FALSE; end; end;
function ViewInBox():boolean; var InboxFolder :OLEVariant; begin Result :=TRUE; if not OutlookExist then begin MessageDlg('Die eMail Funktion ist nicht aktiviert. Bitte ändern Sie die Einstellung in den Systemeinstellungen.',mtInformation,[mbOk],0); EXIT; end;
try InboxFolder :=oleNameSpace.GetDefaultFolder(olFolderInbox); InboxFolder.Display; except Result :=FALSE; end; end;
function AddEmail(Subject,Adress,CC,BB,Body,FileName : string; DirektSend : boolean):boolean; var eMail :OLEVariant; UserProp :OLEVariant; begin Result :=TRUE; if not OutlookExist then begin MessageDlg('Die eMail Funktion ist nicht aktiviert. Bitte ändern Sie die Einstellung in den Systemeinstellungen.',mtInformation,[mbOk],0); EXIT; end; try eMail := oleOutlook.CreateItem(olMailItem); eMail.Subject := Subject; eMail.to := Adress; eMail.cc := cc; eMail.bcc := bb; eMail.body := Body; if trim(FileName) <> '' then eMail.Attachments.add(FileName); eMail.save;
if DirektSend then eMail.send else eMail.display; except Result :=FALSE; end; end;
end. |
aus dem obeigen Source ne Unit bauene, und die grundlegenden Routinen sind vorhanden.
Viel Spaß damit
Beste Grüße
Michael
Moderiert von raziel: Code- durch Delphi-Tags ersetzt.
_________________ Wissen ist Macht, nichts wissen macht auch nichts...
|
|
Björn karpenstein 
      
Beiträge: 96
Windows XP, Linux
D7, K3
|
Verfasst: Do 01.09.05 19:04
Vielen Dank ich werde das ausprobieren 
|
|
Björn karpenstein 
      
Beiträge: 96
Windows XP, Linux
D7, K3
|
Verfasst: Sa 03.09.05 10:38
Hmm
oleOutlook :=NULL;
Er sagt NULL ist ein undefinierter Bezeichner. Habe es auch mal mit NIL probiert, geht aber nicht . o O ( ? )
|
|
meg
      
Beiträge: 24
Win XP Prof.
D6, D2005 Peronal, Turbo Delphi
|
Verfasst: Do 16.02.06 21:16
also falls dus noch nicht gelöst hast, probiers mal mit false
|
|
noidic
      
Beiträge: 851
Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
|
Verfasst: Fr 17.02.06 08:04
NULL ist in der Unit Variants deklariert, wenn du die einbindest, sollte das gehen.
_________________ Bravery calls my name in the sound of the wind in the night...
|
|
|