MailGenF.pas
资源名称:delphi.rar [点击查看]
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:1k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit MailGenF;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls, NMURL, ExtActns, ActnList;
- type
- TForm1 = class(TForm)
- BtnSend: TButton;
- EditAddress: TEdit;
- Label1: TLabel;
- Label2: TLabel;
- EditSubject: TEdit;
- Memo1: TMemo;
- procedure BtnSendClick(Sender: TObject);
- procedure EditAddressChange(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.DFM}
- uses
- ShellApi;
- procedure TForm1.BtnSendClick(Sender: TObject);
- var
- strMsg: string;
- I: Integer;
- begin
- // set the basic information
- strMsg := 'mailto:' + EditAddress.Text +
- '?Subject=' + EditSubject.Text +
- '&Body=';
- // add first line
- if Memo1.Lines.Count > 1 then
- strMsg := strMsg + Memo1.Lines [0];
- // add subsequent lines separated by the newline symbol
- for I := 1 to Memo1.Lines.Count - 1 do
- strMsg := strMsg + '%0D%0A' + Memo1.Lines [I];
- // send the message
- ShellExecute (Handle, 'open', pChar (strMsg),
- '', '', SW_SHOW);
- end;
- procedure TForm1.EditAddressChange(Sender: TObject);
- begin
- BtnSend.Enabled := EditAddress.Text <> '';
- end;
- end.