lamw / ghettoVCB

ghettoVCB
MIT License
1.29k stars 365 forks source link

SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised) #302

Open zuehls opened 1 year ago

zuehls commented 1 year ago

Email functionality was not working. Discovered the following pull request was completed a while back but the value that was set '4' does not provide enough lines of delay for my SMTP relay to work correctly (subject includes error). I changed the senddelay from '4' to '5' or higher and now email log is successfully sent.

https://github.com/lamw/ghettoVCB/pull/75

zuehls commented 1 year ago

I've improved this by counting the number of lines in the EMAIL_LOG_HEADER and using it's value as the number of lines to add to the sendDelay function.

sendDelay() {

count number of lines in EMAIL_LOG_HEADER to apply the delay from EMAIL_DELAY_INTERVAL from NC (netcat)

EMAIL_LINES_TO_DELAY=$(cat "${EMAIL_LOG_HEADER}" | wc -l)

c=0                
while read L; do
    #[ $c -lt 4 ] && sleep ${EMAIL_DELAY_INTERVAL}
    [ $c -lt "${EMAIL_LINES_TO_DELAY}" ] && sleep ${EMAIL_DELAY_INTERVAL}
    c=$((c+1))                                                           
    echo $L                                                                                  
done      

}