.NET project stopped sending emails after server migration

0

I migrated a .NET Framework REST API project into a new server and new domain. The OS on both the previous and the new server are Windows Server 2016. I'm using gmail smtp server over SSL/TLS. The relevant ports are open in AWS (where I migrated to).

I am able to send emails manually using powershell, but when calling the API, nothing happens. The same smtp config works on the old server - so this part is fine.

I'm a bit clueless when it comes to windows server and/or .NET and I might have missed something obvious. For example, I'm not sure whether I need to setup SMTP server on IIS when using gmail smtp.

UPDATE:

following @TheEdge suggestion, I looked around in the Event Log and it looks like I'm getting Audit Failures. I can't make sense out of it though.

An account failed to log on.

Subject:
    Security ID:        NULL SID
    Account Name:       -
    Account Domain:     -
    Logon ID:       0x0

Logon Type:         3

Account For Which Logon Failed:
    Security ID:        NULL SID
    Account Name:       USER4
    Account Domain:     

Failure Information:
    Failure Reason:     Unknown user name or bad password.
    Status:         0xC000006D
    Sub Status:     0xC0000064

Process Information:
    Caller Process ID:  0x0
    Caller Process Name:    -

Network Information:
    Workstation Name:   -
    Source Network Address: __.___.___.___
    Source Port:        0

Detailed Authentication Information:
    Logon Process:      NtLmSsp 
    Authentication Package: NTLM
    Transited Services: -
    Package Name (NTLM only):   -
    Key Length:
c#
.net
iis
smtp
windows-server
asked on Stack Overflow Feb 17, 2019 by yohairosen • edited Feb 17, 2019 by yohairosen

1 Answer

1

The "thing" doing the send of email via SMTP is where you have to look. So probably best if you provide the code that actually does the SMTP send. Because you are using Google to send the email there is nothing you have to setup in IIS to make this work.

My guess is that you have a permissions problem when sending email from your API inside IIS. Have you had a look in the Event Log to see if there are any messages in there or does not application emit any logging for exceptions and the like?

To quickly diagnose any network issues I suggest you have a look at how to configure network tracing in .NET and then have a look at any error messages in there. That log will tell you whether the application is having issues making it out of the network and/or connecting to Google.

answered on Stack Overflow Feb 17, 2019 by TheEdge

User contributions licensed under CC BY-SA 3.0