0

I am trying to send email outside our domain network. I have done this for months within my company domain without any problem. Now I am trying to create customer email process. the code is simple using system.net.mail

        string Recipient = "someone@gmail.com";
        string from = "Donotreply@mydomain.com";
        MailMessage mail = new MailMessage(from, Recipient);

        mail.Subject = "Your..."
        mail.Body = message;
        mail.IsBodyHtml = true;

       SmtpClient client = new SmtpClient("mydomainip");
       client.port=25;
       client.UseDefaultCredentials = true;
       client.Send(mail);

In the webconfig I added:

<system.net>
<mailSettings>
  <smtp deliveryMethod="Network">
    <network host="mydomainip" port="25" defaultCredentials="true"/>
  </smtp>
</mailSettings>

then I setup IIS with domain ip in the host and windows as credential. I am able to send email when debugging on my own computer, but once I publish the application to IIS, no email come, the application throw no error and I even receive the message email sent(I have set it up in my application). please help Note: We don't want to write the server's credential in the web.config for security purpose. Thanks

  • Does the port 25 is open on the server? – Marcus Vinicius Mar 16 '15 at 17:24
  • I assume because this is the same port we use to send internal email within the company. our email server is not on the same server. – user3658357 Mar 16 '15 at 17:32
  • Have you checked the firewall on that server, also does it allow Port Relay? – Greg Mar 16 '15 at 17:33
  • ASSuMe nothing, from the server open a command prompt and type telnet mydomainip 25 you should get back are ">" Here a page to explain more. http://support.microsoft.com/en-us/kb/153119 – Dbloch Mar 16 '15 at 17:36
  • Thanks Guys, it was a setting (relay) problem with our server, solved by the infrastructure team. – user3658357 Mar 19 '15 at 20:19

0 Answers0