Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fallo al enviar correo

0 views
Skip to first unread message

Nhoa78

unread,
Jan 5, 2005, 8:15:03 AM1/5/05
to
Hola a todos.

Para enviar un correo electronico utilizo la siguiente funcion:
private bool sendMail(string From, string To, string Subject, string
Mensaje, string SmtpServer, string Attach)
{
try
{
MailMessage oMsg = new MailMessage();
oMsg.From = From;
oMsg.To = To;
oMsg.Subject = Subject;

// SEND IN HTML FORMAT (comment this line to send plain text).
oMsg.BodyFormat = MailFormat.Html;
//oMsg.BodyFormat = MailFormat.Text;
oMsg.Body = Mensaje;
if (Attach !=null)
{
MailAttachment myAttachment = new
MailAttachment(Attach);
oMsg.Attachments.Add(myAttachment);
}
// TODO: Replace with the name of your remote SMTP server.
SmtpMail.SmtpServer = SmtpServer;
SmtpMail.Send(oMsg);

oMsg = null;
Attach=null;
return true;
}
catch (Exception e)
{
//Console.WriteLine("{0} Exception caught.", e);
return false;
}
}

El problema es que cuando pongo como smtp (ej: mailhost.servidor.es) solo me
deja enviar mensajes a direcciones de correo X...@servidor.es. Si pongo un otra
dirección ej: p...@hotmail.com me da el siguiente error:
"Could not access 'CDO.Message' object."

Emir Treviño

unread,
Jan 5, 2005, 9:37:10 AM1/5/05
to
El problema es porque tu servidor smtp requiere authenticación...

para eso un susuario registrado en tu servicio de correo debe
authentificarse, puedes usar

oMsg..Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
oMsg.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] =
"myusername";
oMsg.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] =
"mypass";

Saludos

Emir Treviño
MEXICO

Jorge

unread,
Jan 5, 2005, 10:02:52 AM1/5/05
to
A mi me pasaba igual, me puse en contacto con los que tienen nuestro hosting
y me dijeron otro servidor smtp que podía usar para que no fallara. Ponte en
contacto con ellos. Un saludo

"Emir Treviño" <emir.t...@gmail.com> escribió en el mensaje
news:BE6DCFA5-C655-48C4...@microsoft.com...

Emir Treviño

unread,
Jan 5, 2005, 11:59:12 AM1/5/05
to
Tambien puedes hacerlo, pero debes tener en cuenta que no es recomendable
usar un servidor SMTP REMOTO, sin authentificación por lo siguiente:

* Seguramente lo usarán muchos como tu, sobre todo para enviar spamm
* Por su uso ilimitado, se saturara y aveces tus correos no podrán enviarse
* será más lento de lo normal
* Fomentas el uso de servidores inseguros y el spamm

Si en realidad deseas NO USAR authenticación te recomiendo que uses un
servidor interno, por ejemplo el servicio SMTP del IIS, y que bloquees el
puerto 25 al exterior.

Saludos

Emir Treviño
MEXICO

0 new messages