Hola tengo una situacion mera rara, cree una mi aplicacion desktop para mandar correos electronicos pero viene una situacion cuando pruebo mi aplicacion desde mi computadora con SO windows 7 si me lo envia todo bien pero cuando pruebo mi aplicacion en otra computadora con SO windows server 2008 me muestra el siguiente error:
"the remote name could not resolved", y no entiendo porque si es el mismo codigo, mi codigo para mandar el correo es el siguiente:
public void send()
{
MailMessage mail = new MailMessage();
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
mail.From = new System.Net.Mail.MailAddress("
[email protected]", "Prueba");
mail.To.Add(new System.Net.Mail.MailAddress("
[email protected]"));
mail.Subject = "Enviar correo de Prueba";
mail.IsBodyHtml = true;
string htmlstr = "<html><body><br><br><h4>ESTO ES UNA PRUEBA (sujeto a cambios)</h4><br/><br/>";
htmlstr += "<html><body><CAPTION><b>" Estimado Persona ":</b><CAPTION><br/><br/>";
htmlstr += "<p>Adjunto a este correo sirve para una prueba.<br/><br/>";
</br></body></html>";
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(htmlst r, Encoding.UTF8, System.Net.Mime.MediaTypeNames.Text.Html);
if (File.Exists("logo.jpg"))
{
LinkedResource img = new LinkedResource("logo.jpg", System.Net.Mime.MediaTypeNames.Image.Jpeg);
img.ContentId = "imagen";
htmlView.LinkedResources.Add(img);
}
Attachment attach = new Attachment(Archivo, MediaTypeNames.Application.Octet);
mail.Attachments.Add(attach);
// Por último, vinculamos la vista al mensaje...
mail.AlternateViews.Add(htmlView);
// Y lo enviamos a través del servidor SMTP...
smtp.Host = nombredelservidor(no es el de gmail es de otro hosting);
port = 25;
smtp.Port = port;
smtp.Credentials = new System.Net.NetworkCredential(txtUsuario.ToString() , txtPass.ToString());
smtp.EnableSsl = true;
smtp.Send(mail);
}