I'm trying to send an email from web service that located at the DMZ using pineApp server that suppose to move the message to the exchange server inside the LAN. The IIS server which the ASMX is on, is defined as relay at the pineApp server.
I'm getting the
An existing connection was forcibly closed by the remote host
and I'm not sure why. If I test it from inside the LAN and call directly to the exchange, it works fine.
This is the code I use:
MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress("mail@stam.co.il");
MailAddress mailMessageTo = new MailAddress(Recipients);
mailMessage.To.Add(mailMessageTo);
mailMessage.Subject = Subject;
mailMessage.Body = Body;
mailMessage.IsBodyHtml = true;
SmtpClient smtpClient = new SmtpClient(SmtpClientName,25);
smtpClient.EnableSsl = false;
smtpClient.UseDefaultCredentials = false;
smtpClient.Send(mailMessage);
I hope I include all the information.