procedure TForm1.FlatButton3Click(Sender: TObject);
var
ssql,body : string;
src :variant;
i :integer;
begin
src :=webbrowser1.Document;
if varIsempty(src) then exit;
body :=src.Body.innerhtml;
if pay.Checked = true then
begin
ssql :='select a.id,a.email,name from allmember a join pay_member p on a.id=p.id where endday>= '''+datetostr(date)+''' and mem_type=''C'' and send_email=''Y'' and email like ''%@%'' order by endday desc';
end
else if admin.Checked = true then
begin
ssql :='select id,email,name from allmember where mem_type=''Z'' and send_email=''Y'' and email like ''%@%'' ORDER BY name desc';
end;
adoquery1.close;
adoquery1.SQL.clear;
adoquery1.sql.add(ssql);
adoquery1.open;
adoquery1.first;
With NMSMTP1 do
begin
Charset:='euc-kr';
Host:='naya-god@infostock.co.kr';
Port:=25;
UserID:='duckskim';
Connect;
//PostMessage.FromName:=; //보내는넘 이름
PostMessage.FromAddress:='naya-god@infostock.co.kr'; //보내는넘 메일주소
PostMessage.Subject:='죄송합니다.지금 test중입니다.';
while not adoQuery1.Eof do
begin
PostMessage.ToAddress.Add(adoQuery1.FieldByName('email').asString);
PostMessage.Body.Add(body);
Try
SendMail;
PostMessage.Body.Clear;
PostMessage.ToAddress.Clear;
PostMessage.Body.Clear;
adoQuery1.Next;
except
PostMessage.Body.Clear;
PostMessage.ToAddress.Clear;
PostMessage.Body.Clear;
adoQuery1.Next;
end;
end;
Disconnect;
PostMessage.ToAddress.Clear;
PostMessage.Body.Clear;
PostMessage.Attachments.Clear;
ShowMessage('모든 메일이 발송되었습니다');
end;
end;