was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

30 Visitors Online


 
...eine Email mit Attachment mit ShellExecute über Outlook Express verschicken?
Autor: Guest
Homepage: http://kingron.delphibbs.com
[ Tip ausdrucken ]  

Tip Bewertung (37):  
     


{
  Shellexecute(Handle,'open','mailto:aaaa@bbb.com?subject&body=body
  text&CC=aaaa&bcc=dddd&attach=FileName',nil,nil,SW_SHOW)
  only works with outlook, not for outlook express,
  but the method below can send attachment to outlook express
}

uses
  
ComObj;

procedure SendMail(Subject, Body, RecvAddress : string; Attachs : array of string);
var
  
MM, MS : Variant;
  i : integer;
begin
  
MS := CreateOleObject('MSMAPI.MAPISession');
  try
    
MM := CreateOleObject('MSMAPI.MAPIMessages');
    try
      
MS.DownLoadMail := False;
      MS.NewSession := False;
      MS.LogonUI := True;
      MS.SignOn;
      MM.SessionID := MS.SessionID;

      MM.Compose;

      MM.RecipIndex := 0;
      MM.RecipAddress := RecvAddress;
      MM.MsgSubject := Subject;
      MM.MsgNoteText := Body;

      for i := Low(Attachs) to High(Attachs) do
      begin
        
MM.AttachmentIndex := i;
        MM.AttachmentPathName := Attachs[i];
      end;
      MM.Send(True);
      MS.SignOff;
    finally
      
VarClear(MS);
    end;
  finally
    
VarClear(MM);
  end;
end;

procedure TForm1.FormCreate(Sender : TObject);
begin
  
SendMail('Subject', 'Body'#13#10'Second', 'BillGates@Microsoft.com',
    ['C:\Winnt\explorer.exe', 'C:\winnt\win.ini']);
end;

 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners