I try to send emails from my ESXI servers but for a reason I don't know I get errors.
this is the command I use to send the email :
nc -Cv smtp.relay.us 25 < /vmfs/volumes/Vcloud-Datatstore/Tools/mail.txt
And this is the file mail.txt:
HELO smtp.relay.us
MAIL FROM:<[email protected]>
RCPT TO:<[email protected]>
DATA
From: [Log Server] <maillog@gkmonitor>
To: <[email protected]>
Date: Mon, 29 May 2017 20:25:38 +0000
Subject: Resultat de la restauration de GED
blabla
blabla
.
I get these output :
220-*****************************
220 *****************************
250 smtp.relay.us
250 2.1.0 Ok
250 2.1.5 Ok
503 5.5.0 <DATA>: Data command rejected: Improper use of SMTP command pipelining
502 5.5.2 Error: command not recognized
...
...
I don't understand what I'm doing wrong. Many thanks by advance.
Finally made it work.
I don't know why but nc sends to much information at one time once reached DATA part of the mail. Even introducing interval between each line with -i option did not helped.
So this is how I made it works (massively inspired by GhettoVCB script):
cat "mail.txt" |while read L; do sleep "1"; echo "$L"; done | "nc" -C -v "smtp.relay.us" "25"
Nothing changed in mail.txt
Bye