因为我们公司是用notes做邮件服务器的,我不知道用delphi的控件能不能发送邮件。所以想实现这样的功能:在程序中调用outexpress,并建立outexpress的帐户,设置服务器地址并发送邮件。

解决方案 »

  1.   

    发送邮件:
    uses
      Shellapi;
    var
      Command: string;
    begin
      Command := 'mailto:[email protected]?subject='The subject line'; 
      ShellExecute(0, nil, PChar(Command), nil, nil, SW_SHOWNORMAL);
      

  2.   

    send an e-mail through Outlook?  
    Autor: Thomas Stutz  
    uses 
      ComObj; procedure TForm1.Button16Click(Sender: TObject); 
    const 
      olMailItem = 0; 
      olByValue = 1; 
    var 
      OutlookApp, MailItem, MyAttachments: OLEVariant; 
    begin 
      try 
        OutlookApp := GetActiveOleObject('Outlook.Application'); 
      except 
        OutlookApp := CreateOleObject('Outlook.Application'); 
      end; 
      try 
        MailItem := OutlookApp.CreateItem(olMailItem); 
        MailItem.Recipients.Add('[email protected]'); 
        MailItem.Subject := 'Your Subject'; 
        MailItem.Body    := 'Your Message'; 
        myAttachments    := MailItem.Attachments; 
        myAttachments.Add('C:\SomeFile.txt', olByValue, 1, 'Name of Attachment'); 
        MailItem.Send; 
      finally 
        myAttachments := VarNull; 
        OutlookApp    := VarNull; 
      end; 
    end; 
      

  3.   

    这个只是一个调用outexpress的函数,不能设置发件人的帐户,等内容啊。
      

  4.   

    建新聯系人
    create a new Outlook Contact?  
    Autor: Michael Klemm  uses 
      ComObj, Variants, SysUtils; type 
      TContact = record 
        LastName: string; 
        FirstName : string; 
        Company : string; 
        // ###  Further properties. See MSDN 
      end; 
      //------------------------------------------------------------------------------ 
    {:Add outlook contact @param ContactFolderPath The contact path. E.g.: '' for default contact folder, 
      'SubFolder\Sub2\Test' for subfolders 
    @param Contact The contact informations. 
    @author 19.09.2003 Michael Klemm} 
      //------------------------------------------------------------------------------ 
    procedure OutlookAddContact(ContactFolderPath : string; Contact : TContact); 
    const 
      olFolderContacts = $0000000A; 
    var 
      Outlook : OleVariant; 
      NameSpace : OleVariant; 
      ContactsRoot : OleVariant; 
      ContactsFolder : OleVariant; 
      OutlookContact : OleVariant; 
      SubFolderName : string; 
      Position : integer; 
      Found : boolean; 
      Counter : integer; 
      TestContactFolder : OleVariant; 
    begin 
      // Connect to outlook 
      Outlook := CreateOleObject('Outlook.Application'); 
      // Get name space 
      NameSpace := Outlook.GetNameSpace('MAPI'); 
      // Get root contacts folder 
      ContactsRoot := NameSpace.GetDefaultFolder(olFolderContacts); 
      // Iterate to subfolder 
      ContactsFolder := ContactsRoot; 
      while ContactFolderPath <> '' do 
      begin 
        // Extract next subfolder 
        Position := Pos('\', ContactFolderPath); 
        if Position > 0 then 
        begin 
          SubFolderName := Copy(ContactFolderPath, 1, Position - 1); 
          ContactFolderPath := Copy(ContactFolderPath, Position + 1, Length(ContactFolderPath)); 
        end 
        else 
        begin 
          SubFolderName := ContactFolderPath; 
          ContactFolderPath := ''; 
        end; 
        if SubFolderName = '' then 
          Break; 
        // Search subfolder 
        Found := False; 
        for Counter := 1 to ContactsFolder.Folders.Count do 
        begin 
          TestContactFolder := ContactsRoot.Folders.Item(Counter); 
          if LowerCase(TestContactFolder.Name) = LowerCase(SubFolderName) then 
          begin 
            ContactsFolder := TestContactFolder; 
            Found := True; 
            Break; 
          end; 
        end; 
        // If not found create 
        if not Found then 
          ContactsFolder := ContactsFolder.Folders.Add(SubFolderName); 
      end; 
      // Create contact item 
      OutlookContact := ContactsFolder.Items.Add; 
      // Fill contact information 
      OutlookContact.FirstName := Contact.FirstName; 
      OutlookContact.LastName := Contact.LastName; 
      OutlookContact.CompanyName := Contact.Company;   // ### Further properties   // Save contact 
      OutlookContact.Save; 
      // Disconnect from outlook 
      Outlook := Unassigned; 
    end;
      

  5.   

    有没有outlookexpress详细一些的呢?
      

  6.   

    感谢aiirii(ari-爱的眼睛)的热心帮助。我先试一试。如果能做出来会把解决办法贴来