SMTP: cannot send email from windows server 2012

1

I have strictly followed this tutorial in order to configure SMTP server on Windows Server 2012 R2 by usng IIS 6. In fact, if I create a correct formatted file email.txt inside

C:\inetpub\mailroot\Pickup

with From, To and Subject fields, it is dispatched immediately to the destination email address with the correct sender. Then, I have a framework generating my ASP NET C# web application ad when it tried to send an email with:

 IDMailer v_M1 = null;
 v_M1 = (IDMailer)new IDMailer();
 v_M1.FromAddress = (new IDVariant("allegretti@er-go.it")).stringValue();
 v_M1.AddToAddress((new IDVariant("lorenzo.vinci@conservice.it")).stringValue()); 
 v_M1.Subject = (new IDVariant("prova")).stringValue();
 v_M1.HTMLBody = (new IDVariant("<b>ciao!</b>")).stringValue();
 try
 {
   v_M1.SendMail();
 }
 catch (Exception e3)
 {
   MainFrm.set_AlertMessage(new IDVariant(e3.Message)); 
 }

then I have an error in sending the email which fails. I have tried also both the following settings in the application pool of my web application:

enter image description here

and they both fail with these error messages:

Thursday, October 6, 2016 - 5:38:09 PM
Failure sending mail.
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at com.progamma.IDMailer.SendMail()
 DTT_LEVEL=5
 DTT_MSGLEVEL=3
 DTT_LEVEL=5
 DTT_MSGLEVEL=3
 Failure sending mail.
   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   at com.progamma.IDMailer.SendMail()
   The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available

   at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
   at System.Web.Mail.SmtpMail.CdoSysHelper.Send(MailMessage message)
   at System.Web.Mail.SmtpMail.Send(MailMessage message)
   at com.progamma.IDMailer.SendMailSSL()
--------------------------------------------------------------------
Thursday, October 6, 2016 - 5:38:25 PM
Failure sending mail.
 at System.Net.Mail.SmtpClient.Send(MailMessage message)
 at com.progamma.IDMailer.SendMail()

I have no idea why this happens but I really need to correctly set up a SMTP server in our Windows Server. I had tried to use Google smtp server as realy and it was ok but it did not allow us to set an arbitrary sender email address but only the one of the account used to connect to gmail smtp server. That's why I need my SMTP server because sender anddress will vary according to the user logging into the web application. How can I solve this? Maybe does this happen because the web applicaion is installed inside drive D (which has its own pickup emailroot directories) instead of C drive?

c#
email
smtp
windows-server-2012-r2
windows-server
asked on Stack Overflow Oct 6, 2016 by SagittariusA • edited Oct 6, 2016 by SagittariusA

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0