0

I am trying to create a Dropoff email folder in my d drive within my SharePoint dev environment. I went to IIS and given the email dropoff folder path and port number as 25 but mails are not sending from .net console application.

what may be the reason for this?I am trying to create a code using powershell as well. that also failed

        Add-PsSnapin Microsoft.SharePoint.PowerShell
        $email = "NPDDevWF@doman1.com"
        $subject = "Test subject111"
        $body = "Test body"
        $site = New-Object 
      Microsoft.SharePoint.SPSite "http://srvrv1:28516/"
        $web = $site.OpenWeb()
        [Microsoft.SharePoint.Utilities.SPUtility]::SendEmail      
        ($web,0,0,$email,$subject,$body)
        # True or False will confirm the message has been sent or not

       $emailFrom = "NPDDevWF@dominnn.com"
       $subject="snding mail from powershell int server prasad"
       $smtpserver="srvr1.ad.domainn.com"
       $smtp=new-object Net.Mail.SmtpClient($smtpServer)
       $smtp.Send($emailFrom, $emailTo, $subject, $message)

IIS-SMTPEMAILSETTINGS-LOCALSERVER

below is my spuiltity sendmail code:

  Add-PsSnapin Microsoft.SharePoint.PowerShell
  $email = "NPDDevWF@mydomain.com"
  $subject = "Test subject111"
  $body = "Test body"
     $site = New-Object 
   Microsoft.SharePoint.SPSite "http://srvr001s:28516/"
    $web = $site.OpenWeb()
   [Microsoft.SharePoint.Utilities.SPUtility]::SendEmail  
   ($web,0,0,$email,$subject,$body)

     [![outgoing-email-settings1][1]][1]

    it returns a `False`  

this is the error , am getting :



at System.Net.Mail.SmtpClient.Send(MailMessage message)

am trying it with a winforms appln on button click :

at WindowsFormsApplication1.Form1.SendMail(String smtpAddress, String subject, String body, Boolean isBodyHtml, String from, String to, String cc, String bcc) in c:\Users\muser11\Documents\Visual Studio 2013\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs:line 101___System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 172.21.17.141:25

at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)

at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

--- End of inner exception stack trace ---

at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6)

at System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback)

at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)

at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)

at System.Net.Mail.SmtpClient.Send(MailMessage message) __ Failure sending mail.

OK

  • try using port 587 – SharePointMan Apr 12 '17 at 12:23
  • I tried with it port 587, that also failed – SaMolPP Apr 12 '17 at 13:18
  • I tried it with sputility .sendmail method as well. – SaMolPP Apr 12 '17 at 13:20
  • Actually, the smtp server is NOT actual one. its simply a dropoff folder I created in the IIS, with port number 587. when I tried it with sp designer workflow 2013, the emails were sent / dumped to the folder successfully, but when I tried to do the same in console appln and using system.net api and sputilitty api, its failed. – SaMolPP Apr 12 '17 at 13:57
  • Did you try giving username password ? Although it is SMPT, try giving username password – SharePointMan Apr 12 '17 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.