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?

SagittariusA
  • 5,289
  • 15
  • 73
  • 127
  • usually this is caused by a wrong username or password, or an incorrect IP address, or antivirus/firewall blocking the port. – user1666620 Oct 06 '16 at 16:20
  • I think that is not the cause because as the video showed I did not allow authentication but anonimous connections to the server and the IP address is correct. I don't even think the antivirus blocks the 25 port because if I write a file.txt inside the Pickup directory than the email is sent at once... – SagittariusA Oct 06 '16 at 16:22
  • Is the port blocked by the firewall or antivirus? – user1666620 Oct 06 '16 at 16:24
  • I will check it tomorrow as soon as I have entered my office again. Anyway, I really don't think the port is blocked or I wouldn't be able to send email by writing a file inside the Pickup directory... moreover our framework makes the web application runs entirely inside the server while on client side there's just some js+html+css... so the request to send an email is stared inside the server itself – SagittariusA Oct 06 '16 at 16:33

0 Answers0