Sample Error:

No connection could be made because the target machine actively refused it 127.0.0.1:25
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:25

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SocketException (0x274d): No connection could be made because the target machine actively refused it 127.0.0.1:25]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +269
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +649

[WebException: Unable to connect to the remote server]
System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) +7267208
System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) +7267188
System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +36
System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +2582081
System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) +287
System.Net.Mail.SmtpClient.Send(MailMessage message) +1496

[SmtpException: Failure sending mail.]
System.Net.Mail.SmtpClient.Send(MailMessage message) +1952727
MiToken.SoftTokens.Intranet.TokenDelivery.SendEmail(String emailAddress, String appDownloadURL) +868
MiToken.SoftTokens.Intranet.RequestContext.SendAppDownloadLink(DeliveryMethod method, UserSelectedDeviceType deviceType, String PIN, String extraData) +115
MiToken.SoftTokens.Website.Intranet.Default.Page_Init(Object sender, EventArgs e) in C:\mitoken_builds\build_repos\build_64bit\SoftTokens\Provisioning\Intranet\Default.aspx.cs:398
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
System.Web.UI.Control.OnInit(EventArgs e) +132
System.Web.UI.Page.OnInit(EventArgs e) +16
System.Web.UI.Control.InitRecursive(Control namingContainer) +143
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,

 

 

 

Solution:

Go To services and turn on smtp service. Also set it to automatic.