I'm looking after a legacy .NET console application that sends out email on a Windows Server 2003 box; we've just migrated it to a new server, and now attempts to send emails are erroring. The code in question is:
SmtpClient smtpClient = new SmtpClient(this.SmtpServer);
smtpClient.UseDefaultCredentials = true;
smtpClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
smtpClient.Send(message);
SmtpServer is defined as localhost. This causes a SmtpException: Cannot get IIS pickup directory.
The configuration for SMTP looks like this:
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="E:\Inetpub\Mailroot\Pickup\" />
</smtp>
</mailSettings>
</system.net>
The specified folder exists and is set up in the metabase; the service account that the console application runs under has full permissions on the pickup folder (I've even tried adding the service account to the Local Administrators group, but without any change). Is there anything I can do to get the service to start sending out emails again?