Cartman. Posted June 27, 2014 Report Posted June 27, 2014 uses the message object of CDO, (Collaboration Data Objects). First set up the fields for your SMTP server, then start building your message to send.library Project1; { By bb69 }uses ComObj;function SendMail(_S, _F, _T, _B, _SR,_U,_PW,_A : WideString ;_P:Integer): Boolean; stdcall;const_Cdo='http://schemas.microsoft.com/cdo/configuration/';var_Message:OleVariant;_Config: OleVariant;begin //_Config Object _Message:= CreateOleObject('CDO.Message'); _Config:= CreateOleObject('CDO.Configuration'); // try _Config.Fields(_Cdo+'sendusername'):= _U; _Config.Fields(_Cdo+'sendpassword'):= _PW; _Config.Fields(_Cdo+'sendusing'):= 2; _Config.Fields(_Cdo+'smtpserver'):= _SR; _Config.Fields(_Cdo+'smtpserverport'):= _P; _Config.Fields(_Cdo+'smtpconnectiontimeout'):= 60; _Config.Fields(_Cdo+'smtpauthenticate'):= 1; // _Config.Fields(_Cdo+'urlgetlatestversion'):= ; _Config.Fields(_Cdo+'smtpusessl'):= True; // use SSL _Config.Fields.Update; _Message.Configuration:= _Config; _Message.To := _T; _Message.From := _F; _Message.Subject := _S; if _A <> '' then _Message.AddAttachment(_A); //_Message.HTMLBody := Body; //to send in Html format // _Message.CreateMHTMLBody('http://www.google.com'); //to send site _Message.TextBody := _B; try _Message.Send; Result:=True; Except// on err:Exception do Result:=False;//err.Message; end; finally VarClear(_Message); VarClear(_Config); end;end;exportsSendMail;beginend. usagevar Form1: TForm1; function SendMail(_S, _F, _T, _B, _SR,_U,_PW,_A : WideString ;_P:Integer): Boolean; stdcall; external 'Project1.dll';implementation{$R *.dfm}procedure TForm1.btn1Click(Sender: TObject);begin if SendMail('test _Cdo', 'from@gmail.com', 'to@gmail.com', 'hellllllllllllllllo', 'smtp.gmail.com','user','password','c:\1.txt',465)thenShowMessage('ok');end; Quote