1. °³¹ß/½ÇÇà Ç÷§Æû
(1) OS : À©µµ¿ì7,10
(2) °³¹ßÅø : µ¨ÆÄÀÌ7
(3) »ç¿ë Database : firebird
2. °³¹ß ÁßÀÎ ÇÁ·Î±×·¥
3. Áú¹® ³»¿ë
¾È³çÇϼ¼¿ä?
indy9.0.18 ·Î ¸ÞÀϺ¸³»±â¸¦ ÇÏ°í Àִµ¥¿ä,
º¸³»´Â ¸ÞÀÏ(Email address of sender)ÀÌ naverÀÎ °æ¿ì¿¡´Â ÷ºÎÈÀÏ Å©±â°¡ ÀÛÀ»¶§´Â Àß Àü¼ÛµÇ´Âµ¥¿ä,
15¸Þ°¡ Á¤µµÀÇ Ã·ºÎÈÀÏÀÌ º¸³»ÁöÁö ¾Ê½À´Ï´Ù.
»çÀÌÁî°¡ ÃÊ°¡µÇ¾ú´Ù´Â ¸Þ½ÃÁö¿Í ÇÔ²²¿ä(÷ºÎÈÀÏÂüÁ¶ÇØÁÖ¼¼¿ä).
º¸³»´Â ¸ÞÀÏÀÌ daum ÀÎ °æ¿ì¿¡´Â ¹®Á¦¾øÀÌ º¸³»Áö°í¿ä.
¾î¶»°Ô ÇØ°áÇØ¾ß ÇÒ±î¿ä?
°æÇèÀÖÀ¸½ÅºÐÀÇ µµ¿ò Á» ºÎŹµå¸³´Ï´Ù.
¾Æ·¡´Â »ç¿ëÇÏ°í ÀÖ´Â ¼Ò½ºÀÔ´Ï´Ù.
function IdSMTP_Mail(const Server: String; const Port: Integer;const
UserField, PasswordField: String; FromField, ToField, SubjectField, CompanyField,
TextField: WideString; FileNames: TStringList): String;
var
IdSMTP: TIdSMTP;
IdMessage: TIdMessage;
IdSSLIOHandlerSocket: TIdSSLIOHandlerSocket;
aFileList:TStringList;
atc:TIdAttachment;
txtpart : TIdText;
htmpart : TIdText;
UTFString : UTF8string;
i:Integer;
begin
Result:='';
IdSMTP := TIdSMTP.Create(nil);
IdSMTP.AuthenticationType := atLogin; // ·Î±×ÀÎ ¹æ½Ä
IdSMTP.Host := Server;
IdSMTP.Port := Port;
IdSMTP.Username:=UserField;
IdSMTP.Password:=PasswordField;
IdSSLIOHandlerSocket:=TIdSSLIOHandlerSocket.Create(nil);
IdSSLIOHandlerSocket.SSLOptions.Method:=sslvSSLv23;
IdSMTP.IOHandler:=IdSSLIOHandlerSocket;
IdMessage := TIdMessage.Create(nil);
IdMessage.CharSet := 'euc-kr';
IdMessage.Headers.Text := 'Content-type: text/html';
IdMessage.ContentType := 'text/html';
IdMessage.From.Name := CompanyField; //º¸³»´Â À̸§
IdMessage.From.Address := FromField; // º¸³»´Â»ç¶÷ ¸ÞÀÏÁÖ¼Ò
IdMessage.Recipients.EMailAddresses := ToField;//¹Þ´Â»ç¶÷ ¸ÞÀÏÁÖ¼Ò
IdMessage.Subject := SubjectField; // Á¦¸ñ
IdMessage.Body.Add(TextField);
Try
//ÈÀÏ÷ºÎ°ü·Ã===============
if FileNames<>nil then begin
if FileNames.Count>0 then begin
For i:=0 to FileNames.Count-1 do begin
TIdAttachment.Create(IdMessage.MessageParts, Trim(FileNames.Strings[i]));
end;
txtpart := TIdText.Create(IdMessage.MessageParts);
txtpart.ContentType := 'text/plain';
htmpart := TIdText.Create(IdMessage.MessageParts);
UTFString := UTF8Encode(WideString(TextField)); // <--- delphi 7 version ÇÔ¼ö
htmpart.Body.Add(UTFString);
htmpart.ContentType := 'text/html';
end;
end;
Try
IdSMTP.Connect;
IdSMTP.Send(IdMessage);
Except
on E:Exception do begin
Result:='¸ÞÀÏÀü¼ÛÁß ¿À·ù¹ß»ý!'+#13+E.Message;
end;
End;
Finally
if FileNames.Count>0 then begin
txtpart.Free;
htmpart.Free;
end;
IdSMTP.Disconnect;
IdSMTP.Free;
IdSSLIOHandlerSocket.Free;
IdMessage.Free;
IdSMTP:=nil;
IdSSLIOHandlerSocket:=nil;
IdMessage:=nil;
end;
end;