I have been using stunnel and Blat for several years to send emails. Recently 
all the emails stopped. Interestingly I also use PowerShell to send emails and 
they all stopped as well. That would seem to point to something external but I 
have no clue what that might be. I have searched the web and have found several 
posts talking about (Error: Not a Socket) from Blat log but I have been unable 
to find a solution. In any event for stunnel I have added below the config file 
and the log file with debug = 7 enabled and a screen shot of netstat -an. I 
also believe I am running the latest version of Stunnel and Blat. Just for 
additional info I have attached my powershell program and the resultant error. 
Any help on this issue would be greatly appreciated. Incidentally I am not a 
stunnel or Blat person I just want things to work like they were.

; Some performance tunings
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
; Some debugging stuff useful for troubleshooting
debug = 7
output = stunnel.log

; Use it for client mode
client = yes

; Service-level configuration
sslversion = all

;[Protocol]
protocol = smtp

[ssmtp]
accept = 127.0.0.1:25
connect = smtp.live.com:587
===============================================
2022.05.21 15:03:04 LOG5[5916:5920]: Reading configuration from file 
stunnel.conf
2022.05.21 15:03:04 LOG7[5916:5920]: PRNG seeded successfully
2022.05.21 15:03:05 LOG7[5916:5920]: SSL context initialized for service ssmtp
2022.05.21 15:03:05 LOG5[5916:5920]: Configuration successful
2022.05.21 15:03:05 LOG5[5916:5920]: No limit detected for the number of clients
2022.05.21 15:03:05 LOG7[5916:5920]: accept socket: FD=700 allocated 
(non-blocking mode)
2022.05.21 15:03:05 LOG7[5916:5920]: Option SO_REUSEADDR set on accept socket
2022.05.21 15:03:05 LOG7[5916:5920]: Service ssmtp bound to 127.0.0.1:25
2022.05.21 15:03:05 LOG7[5916:5920]: Service ssmtp opened FD=700
2022.05.21 15:03:05 LOG5[5916:5920]: stunnel 4.36 on x86-pc-mingw32-gnu with 
OpenSSL 1.0.0d 8 Feb 2
2022.05.21 15:03:05 LOG5[5916:5920]: Threading:WIN32 SSL:ENGINE Auth:none 
Sockets:SELECT, IPv6

2022.05.21 15:39:56 LOG7[5916:7748]: local socket: FD=692 allocated 
(non-blocking mode)
2022.05.21 15:39:56 LOG7[5916:7748]: Service ssmtp accepted FD=692 from 
127.0.0.1:62680
2022.05.21 15:39:56 LOG7[5916:7748]: Creating a new thread
2022.05.21 15:39:56 LOG7[5916:7748]: New thread created
2022.05.21 15:39:56 LOG7[5916:11272]: Service ssmtp started
2022.05.21 15:39:56 LOG7[5916:11272]: Option TCP_NODELAY set on local socket
2022.05.21 15:39:56 LOG5[5916:11272]: Service ssmtp accepted connection from 
127.0.0.1:62680
2022.05.21 15:39:56 LOG7[5916:11272]: remote socket: FD=740 allocated 
(non-blocking mode)
2022.05.21 15:39:56 LOG6[5916:11272]: connect_blocking: connecting 
204.79.197.212:587
2022.05.21 15:39:56 LOG7[5916:11272]: connect_blocking: s_poll_wait 
204.79.197.212:587: waiting 10 seconds
2022.05.21 15:40:06 LOG3[5916:11272]: connect_blocking: s_poll_wait 
204.79.197.212:587: TIMEOUTconnect exceeded
2022.05.21 15:40:06 LOG5[5916:11272]: Connection reset: 0 bytes sent to SSL, 0 
bytes sent to socket



Partial screen shot of netstat -an


 TCP    127.0.0.1:25               0.0.0.0:0             LISTENING
  TCP    127.0.0.1:4444         0.0.0.0:0              LISTENING
  TCP    127.0.0.1:5354         0.0.0.0:0              LISTENING
  TCP    127.0.0.1:5354         127.0.0.1:53941        ESTABLISHED
  TCP    127.0.0.1:5354         127.0.0.1:58943        ESTABLISHED
  TCP    127.0.0.1:8884         0.0.0.0:0              LISTENING
  TCP    127.0.0.1:9012         0.0.0.0:0              LISTENING
  TCP    127.0.0.1:27015        0.0.0.0:0              LISTENING
  TCP    127.0.0.1:33555        0.0.0.0:0              LISTENING
  TCP    127.0.0.1:42424        0.0.0.0:0              LISTENING
  TCP    127.0.0.1:53941        127.0.0.1:5354         ESTABLISHED
  TCP    127.0.0.1:58943        127.0.0.1:5354         ESTABLISHED
  TCP    127.0.0.1:60485        0.0.0.0:0              LISTENING
  TCP    127.0.0.1:60961        0.0.0.0:0              LISTENING
  TCP    127.0.0.1:62433        0.0.0.0:0              LISTENING
2022.05.21 15:40:06 LOG7[5916:11272]: Service ssmtp finished (0 left)
2022.05.21 15:40:06 LOG7[5916:11272]: str_stats: 0 blocks, 0 bytes

Blat Log
2022.05.21 15:39:56 (Sat)------------Start of Session-----------------
Blat v3.2.19 (build : Nov 18 2017 03:14:35)
32-bit Windows, Full, Unicode
Error: Connection to server was dropped.
*** Error ***  SMTP server error
Error: Not a socket.
Error: Not a socket.
2022.05.21 15:40:06 (Sat)-------------End of Session------------------


$EmailFrom = "[email protected]"
$EmailTo = "[email protected]" 
$Subject = "Checking on Rename Shop Daily Backup on WDMyCloud"


#  This section checks to see if task scheduler returned a value of 0
#  If the value = 0 continue otherwise send email and exit

$filter = @{
    Logname = 'microsoft-windows-taskscheduler/operational'
    ID = 201
    Data = '\My Tasks\SC_Rename Shop Daily Backup Monthly'   
} 

$q = Get-WinEvent -MaxEvents 1 -FilterHashtable $filter  | 
      Select @{n='ResultCode';e={$_.Properties[3].Value}}
         
$z = $q.psobject.Properties.value

echo return = $z

if ($z -ne 0)

{
    $Body = " Task Scheduler has returned error = $z. Check the logs on Main" 
    $SMTPServer = "127.0.0.1" 
    $SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 25) 
    $SMTPClient.Credentials = New-Object 
System.Net.NetworkCredential("[email protected]", "yyyyyy")
    $SMTPClient.Send($EmailFrom, $EmailTo, $Subject,$body)

exit
}


#=======================================================

    $Event = Get-WinEvent -computername main -FilterHashtable 
@{Logname='microsoft-windows-backup';Id=14} -MaxEvents 1
    # Convert the event to XML
    $eventXML = [xml]$Event.ToXml()
    $test = $eventxml.Event.EventData.Data | Where-Object {$_.name -eq 
"Backupwriteendtime"} | select -expandProperty '#text' 
    $test.Substring(23,10) 
    $x = Get-Date -Format o
    $y = $x.substring(0,10)
    $d = Get-Date -DisplayHint  Date
  # This part runs to pass $s to the elseif statement   
   
   $t = $eventxml.Event.EventData.Data  | Where-Object {$_.name -eq 
"Errormessage"}
   $r,$s = $t.'#text' -split "%%" ,2   
    
#--------------------------------------------------------------------

# This section checks to see if Backup date is Today
# If the dates don't match it sends an email then exits otherwise it continues


if ($test.substring(23,10) -notmatch $y)

    {
    $Body = " The last backup date should be today ($d). Check the logs on 
Main"  
    $SMTPServer = "127.0.0.1" 
    $SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 25) 
    $SMTPClient.Credentials = New-Object 
System.Net.NetworkCredential("[email protected]", "yyyyyyyyy")
    $SMTPClient.Send($EmailFrom, $EmailTo, $Subject,$body)
   
exit
}



Exception calling "Send" with "4" argument(s): "Failure sending mail."
At C:\Users\zzzz\Documents\WindowsPowerShell\Scripts\test.ps1:66 char:5
+     $SMTPClient.Send($EmailFrom, $EmailTo, $Subject,$body)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SmtpException
_______________________________________________
stunnel-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to