Okay i got a weird one for you
we have a open smtp server here in the building for sending out alerts and whatnot
I can send from my machine and get an email
My cube mate can send from his machine and i get the email ( they are currently all addressed to me)
If i log on to a machine in my computer lab it doenst work for me
If i other people from my same group ( that have the same AD permissions) with the exception of the one guy they get an error
Code:System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine 10.209.xx.xx:xx
Here is the code i am using
C# Code:
private static void UsatSendMail(string[] To, string From, string Subject, string Message) { SmtpClient server = new SmtpClient("usat-xxxxx"); server.Credentials = new NetworkCredential("user", "pass"); MailMessage email = new MailMessage(); email.From = new MailAddress(From); foreach (string T in To) { email.To.Add(T); } email.Subject = Subject; email.Body = Message; try { server.Send(email); MessageBox.Show("Page Sent"); } catch (SmtpFailedRecipientException error) { MessageBox.Show("error: " + error.Message + "\nFailing recipient: " + error.FailedRecipient); //LogFile(); } catch (Exception ex) { MessageBox.Show(ex.Message); //LogFile(); }
Ive also tried making it a clickonce install package to insure the other people have all the nesscary pre reqs ( .net3.5)
I'm really at a loss as to why it works in some situations and not in others.
If anyone has any idea on what i could look for that might explian this That would be really helpful.


Reply With Quote