liangguowei:
新年快乐.
我自己有一个EXCHANGE完整的开发文档,刚从微软下的,不知道你的是否是新的,
如需要可Mail给你.adodb,ExOLEDB.DataSourc我也没有很清楚的概念,可能是用来
从EXCHANGE的数据库中读取数据的对象,既然有实例,照抄就行.我将自己做的用Exchange
发邮件的程序给你一份.希望对你能有帮助.
procedure TForm1.Button1Click(Sender: TObject);
var
iAppt : IAppointment ;
Config : IConfiguration;
iCalMsg: ICalendarMessage;
iAttn : IAttendee;
iMsg : IMessage;
iMbx : IMailbox;
Person : IPerson;
strURL : string;
Conn: _Connection;
begin
iAppt:=CoAppointment.Create;
Conn:=CoConnection.Create;
Conn.Provider:='ExOLEDB.DataSource';
Conn.Open('Http://adc/exchange/administrator','','',-1);//adc是有EXCHANGE的SERVER
//Set the configuration fields
Config:=CoConfiguration.Create;
Config.Fields.Item['http://schemas.microsoft.com/cdo/configuration/sendusing'].value := cdoSendUsingExchange;
// CdoSendExchange enum value = 3
Config.Fields.Item['http://schemas.microsoft.com/cdo/configuration/sendpassword'].value := '';
Config.Fields.Item['http://schemas.microsoft.com/cdo/configuration/sendusername'].value := 'mailto:administrator@ceal2000.com';
Config.Fields.Item['http://schemas.microsoft.com/cdo/configuration/sendemailaddress'].value := '"administrator"<administrator@ceal2000.com>';
Config.Fields.Item['http://schemas.microsoft.com/cdo/configuration/senduserreplyemailaddress'].value := '"administrator"<administrator@ceal2000.com>';
Config.Fields.Item['http://schemas.microsoft.com/cdo/configuration/mailboxurl'].value := 'http://adc/exchange/administrator';
Config.Fields.Item['http://schemas.microsoft.com/cdo/configuration/activeconnection'].value:= conn;
Config.Fields.Update ;
With iApptdo
begin
Configuration := Config;
//Set the appointment properties
AllDayEvent:=true;
StartTime := strToDateTime('2001-1-2 00:00:00');
EndTime :=strToDateTime('2001-1-2 23:00:00');
Subject := 'Department meeting';
Resources:='room11@ceal2000.com';//Exchange conference server设的mail resource
//Add a required attendee
iAttn:=Attendees.Add('mailto:administrator@ceal2000.com');
iAttn.Role := cdoRequiredParticipant ;
iAttn.Type_ :='Individual';
iAttn:=Attendees.Add('mailto:room11@ceal2000.com');
iAttn.Role := cdoRequiredParticipant ;
iAttn.Type_:='Room';
end;
//Create the calendar message and send it
iCalMsg := iAppt.CreateRequest;
iMsg := iCalMsg.Message ;
iMsg.Send;
end;