interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
btnsimpan: TButton;
edtSMTPServer: TEdit;
edtSMTPPort: TEdit;
edtAccount: TEdit;
edtPassword: TEdit;
edtEmail: TEdit;
lbl1: TLabel;
lbl2: TLabel;
lbl3: TLabel;
lbl4: TLabel;
lbl5: TLabel;
btnbaca: TButton;
procedure btnsimpanClick(Sender: TObject);
procedure btnbacaClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses IniFiles;
{$R *.dfm}
procedure TForm1.btnsimpanClick(Sender: TObject);
var
MailIni: TIniFile;
begin
MailIni := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'setting.ini');
with MailIni do begin
WriteString('Smtp', 'ServerName', edtSMTPServer.Text);
WriteString('Smtp', 'ServerPort', edtSMTPPort.Text);
WriteString('Smtp', 'ServerUser', edtAccount.Text);
WriteString('Smtp', 'ServerPassword', edtPassword.Text);
WriteString('Email', 'PersonalEmail', edtEmail.Text);
end;
MailIni.Free;
end;
procedure TForm1.btnbacaClick(Sender: TObject);
var
MailIni: TIniFile;
begin
MailIni := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'setting.ini');
with MailIni do begin
edtSMTPServer.text := ReadString('Smtp', 'ServerName', 'pop3.server.com');
edtSMTPPort.text := ReadString('Smtp', 'ServerPort', '110');
edtAccount.text := ReadString('Smtp', 'ServerUser', 'your_login');
edtPassword.text := ReadString('Smtp', 'ServerPassword', 'your_password');
edtEmail.text := ReadString('Email', 'PersonalEmail', 'someaddress@somewhere.com');
end;
MailIni.Free;
end;
end.