Ver Mensaje Individual
  #1  
Antiguo 13-11-2007
jesvill jesvill is offline
Registrado
 
Registrado: nov 2007
Posts: 1
Reputación: 0
jesvill Va por buen camino
correo Smtp error

Hola a todos,

Soy novato en delphi y estoy intentando enviar correos desde una aplicación. He visto las herramientas y parece que todo está bien. A la hora de ejecutar el programa , da el siguiente error:
" socket error #10053 software caused Connection error" (no se puede conectar con el servidor)
El outlook funciona correctamente con el mismo puerto (25).
Tengo Delphi6 y Indy9

Estoy un poco perdido , no se que puede pasar. Adjunto código:

Código Delphi [-]

Unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons,idsmtp,IdMessage;
type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}

procedure TForm1.BitBtn1Click(Sender: TObject);
var
smtp : tidsmtp;
mail : TIdMessage;
begin
smtp:=tidsmtp.create(self);
mail:=TIdMessage.create(self);
with smtp do
begin
port:=25;
Host:='mihost';
userid:='[email protected]';
Password:='xxxxx';
end;

with mail do
begin
recipients.add;
recipients[0].Name:='xxxxxxxxxx';
recipients[0].Address:='[email protected]';
from.Name:='xxxxxxx';
from.Address:='[email protected]';
subject:='Prueba correo';
body.Text:='esto es una prueba de correo';
end;
try
SMTP.Connect; 
except
raise Exception.Create( 'Error al conectar con el servidor.' ); 
end;
screen.Cursor:=crdefault;
try
try
smtp.Send(mail);
showmessage('se envio con exito');
except
on e:exception do
showmessage('NO,no!!');
end;
finally
if smtp.Connected then
smtp.Disconnect;
end;
mail.Free;
smtp.free;
end;
end.

Última edición por dec fecha: 13-11-2007 a las 13:50:10.
Responder Con Cita