Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   .NET (https://www.clubdelphi.com/foros/forumdisplay.php?f=17)
-   -   Error al enviar un email (https://www.clubdelphi.com/foros/showthread.php?t=48102)

SMTZ 15-09-2007 08:50:12

Error al enviar un email
 
Hola, utilizando el siguiente código:

Código:

uses
  SysUtils, System.Web.Mail;

Var
  Mensaje      : MailMessage;

begin
 
  Mensaje := MailMessage.Create;

  Mensaje.From := 'MiUsuario@yahoo.es';
  Mensaje.&To := 'MiUsuario@yahoo.es';
  Mensaje.Subject := 'Prueba';
  Mensaje.Body := 'Texto de prueba';
  Mensaje.BodyFormat := MailFormat.Text;

  Mensaje.Fields.Add('http://schemas.microsoft.com/cdo/configuration/sendusing', '2' );
  Mensaje.Fields.Add('http://schemas.microsoft.com/cdo/configuration/smtpserver', 'smtp.correo.yahoo.es' );
  Mensaje.Fields.Add('http://schemas.microsoft.com/cdo/configuration/smtpserverport', '25' );

  Mensaje.Fields.Add('http://schemas.microsoft.com/cdo/configuration/smtpauthenticate', '1' );
  Mensaje.Fields.Add('http://schemas.microsoft.com/cdo/configuration/sendusername', 'MiUsuario@yahoo.es' );
  Mensaje.Fields.Add('http://schemas.microsoft.com/cdo/configuration/sendpassword', 'MiContraseña' );

  SMTPMail.SmtpServer := 'smtp.correo.yahoo.es';
  SMTPMail.Send ( Mensaje );

  Mensaje.Free;

end.

compila bien, pero da el siguiente error en tiempo de ejecución:

Código:

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has
been thrown by the target of an invocation. ---> System.Runtime.InteropServices.
COMException (0x800A0EA5): Error al actualizar los campos. Para obtener más info
rmación, examine la propiedad Status de los campos de cada objeto individual.
  --- End of inner exception stack trace ---
  at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr,
Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[]
namedParameters)
  at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Bind
er binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureI
nfo culture, String[] namedParameters)
  at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
  at System.Web.Mail.SmtpMail.Send(MailMessage message)

He buscado por Internet pero no he sacado nada en claro. ¿Alguien sabe a qué puede ser debido este error?

Gracias.

SMTZ 15-09-2007 09:26:44

Solucionado
 
Hola, creo que hay algún error en las opciones de configuración del servidor smtp de Yahoo, porque he configurado un servidor de correo en local y no he tenido ningún problema.


La franja horaria es GMT +2. Ahora son las 08:00:09.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi