Foros del Web » Programación para mayores de 30 ;) » .NET »

SmptCliente

Estas en el tema de SmptCliente en el foro de .NET en Foros del Web. hola buenos días, tengo un problema con el SmptClient en C# al ejecutar el programa me da el siguiente error y he buscado por toda ...
  #1 (permalink)  
Antiguo 23/11/2012, 09:16
 
Fecha de Ingreso: abril-2010
Ubicación: Ciudad Autónoma de Buenos Aires
Mensajes: 6
Antigüedad: 14 años
Puntos: 0
Exclamación SmptCliente

hola buenos días, tengo un problema con el SmptClient en C#

al ejecutar el programa me da el siguiente error y he buscado por toda la www y no encuentro solución al tema.

mi error:

<<Esta operación sólo se admite en el SP3 de Windows 2000 o en sistemas operativos posteriores>>

luego hace referencia a la línea del código que es la siguiente


SmtpClient smtpServer = new SmtpClient("mySMTPserver", 25);

Tengo una PC con Windows XP PRO SP3 y el SMTP es un Windows 2003 STD Server.

Si alguien tuvo este problema y me puede decir cuál fue la solución.

Gracias!
  #2 (permalink)  
Antiguo 23/11/2012, 09:18
Avatar de Aquaventus  
Fecha de Ingreso: junio-2010
Ubicación: Lima-Peru , En el alba de la naturaleza
Mensajes: 2.105
Antigüedad: 13 años, 10 meses
Puntos: 267
Respuesta: SmptCliente

Hola jorge_del_toro, por favor colócanos todo el código que usaste inlcuído los imports, usa las etiquetas Highlight para verlo de una mejor manera(Highlight es el combo, selecciona el lenguaje con el que estas trabajando). Saludos!.
__________________
Internet es tener todo el conocimiento global a tu disposición.
Desarrollo de Software - Ejemplos .Net
  #3 (permalink)  
Antiguo 23/11/2012, 09:55
 
Fecha de Ingreso: abril-2010
Ubicación: Ciudad Autónoma de Buenos Aires
Mensajes: 6
Antigüedad: 14 años
Puntos: 0
Respuesta: SmptCliente

using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Mail;

namespace SendMail
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
// lista fija destinatarios los tomo desde un TXT

StreamReader objReader2 = new StreamReader("c:\\Temp\\destinatarios.dat");
string sLine = "";
while (sLine != null)
{
sLine = objReader2.ReadLine();
if (sLine != null)
{
cbxDestinatarios.Items.Add(sLine.ToString().Trim() );
}
}
objReader2.Close();

//tooltips

ToolTip ttp = new ToolTip();
ttp.ShowAlways = true;
ttp.SetToolTip(txtDe, "Remitente");
ttp.SetToolTip(btnCancelar, "Cancelar");
ttp.SetToolTip(Enviar, "Enviar");
ttp.SetToolTip(txtPara, "Destinatario");
ttp.SetToolTip(txtSubject, "Asunto");
ttp.SetToolTip(txtTextoEmail, "Mensaje");
ttp.SetToolTip(cbxDestinatarios, "Lista destinatarios");

// email remitente lo tomo de un txt
StreamReader objReader3 = new StreamReader("c:\\Temp\\remitente.dat");
ArrayList arrText3 = new ArrayList();
string sLine3 = objReader3.ReadLine();
txtDe.Text = sLine3.ToString();
objReader3.Close();

// asunto del email
StreamReader objReader4 = new StreamReader("c:\\Temp\\asunto.dat");
ArrayList arrText4 = new ArrayList();
string sLine4 = objReader4.ReadLine();
txtSubject.Text = sLine4.ToString();
objReader4.Close();
}

private void Enviar_Click(object sender, EventArgs e)
{
if (txtPara.Text == "" || txtTextoEmail.Text == "")
{
MessageBox.Show("faltan datos!!!", "error");
}
else
{
try
{
//Establecemos el Email y el Servidor
SmtpClient smtpServer = new SmtpClient("my.smpt.com", 25);

smtpServer.UseDefaultCredentials = false;
smtpServer.Credentials = new System.Net.NetworkCredential("myusuer", "mypassword");

MailMessage mailMessage = new MailMessage(txtPara.Text, txtDe.Text, txtSubject.Text, txtTextoEmail.Text);

//Enviamos el mail
smtpServer.Send(mailMessage);

MessageBox.Show("Mensaje enviado!");
Application.Exit();

}

catch(Exception ex)
{

cbxDestinatarios.Enabled = true;
Enviar.Enabled = true;
MessageBox.Show(ex.ToString(),"error");
}
}
}

private void cbxDestinatarios_SelectedIndexChanged(object sender, EventArgs e)
{
txtPara.Text = cbxDestinatarios.SelectedItem.ToString().Substring (cbxDestinatarios.SelectedItem.ToString().IndexOf( ":") + 2);
}

private void btnCancelar_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
  #4 (permalink)  
Antiguo 23/11/2012, 09:55
 
Fecha de Ingreso: abril-2010
Ubicación: Ciudad Autónoma de Buenos Aires
Mensajes: 6
Antigüedad: 14 años
Puntos: 0
Respuesta: SmptCliente

desde ya muchas gracias por cualquier ayuda q puedas brindarme
  #5 (permalink)  
Antiguo 23/11/2012, 14:25
 
Fecha de Ingreso: abril-2010
Ubicación: Ciudad Autónoma de Buenos Aires
Mensajes: 6
Antigüedad: 14 años
Puntos: 0
Respuesta: SmptCliente

al final tire el proyecto a la basura y lo reescribi y ahora no me da el error, en fin... esas cosas raras del mundo MS del Sr. Bill Puertas

Etiquetas: c#, smtpclient
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:47.