![]() |
|
#1
|
|||
|
|||
|
Hi all, I try to send an email, but I have a problem, however, I found this code on the web:
Code:
procedure SendSimpleMail;
var
IdSMTP: TIdSMTP;
IdMessage: TIdMessage;
IdEmailAddressItem: TIdEmailAddressItem;
begin
IdSMTP := TIdSMTP.Create(nil);
try
IdSMTP.Host := 'smtp.gmail.com';
IdSMTP.Port := 25;
IdSMTP.AuthType := atDefault;
IdSMTP.Username := 'username@gmail.com';
IdSMTP.Password := 'password';
IdSMTP.Connect;
if IdSMTP.Authenticate then
begin
IdMessage := TIdMessage.Create(nil);
try
IdMessage.From.Name := 'User Name';
IdMessage.From.Address := 'username@gmail.com';
IdMessage.Subject := 'E-mail subject';
IdMessage.Body.Add('E-mail body.');
IdSMTP.Send(IdMessage);
finally
IdMessage.Free;
end;
end;
IdSMTP.Disconnect;
finally
IdSMTP.Free;
end;
end;
Code:
Socket error # 10060 Connection timed out Thanks! |
|
#2
|
|||
|
|||
|
You may want to have a look at this page, as gmail requires a little different configuration than you are working with.
http://support.google.com/mail/bin/a...n&answer=13287
__________________
"not quite smart enough to be dumb" Extended Stats No Longer Available Due To Changes To The Forum.
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|