Skip to content

Instantly share code, notes, and snippets.

@nysean79
Created January 19, 2012 14:36
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nysean79/1640347 to your computer and use it in GitHub Desktop.
Save nysean79/1640347 to your computer and use it in GitHub Desktop.
SMTP relay test script
#!/usr/bin/env bash
## Version 1.0.2
my_email_body="Test from telnet"
mail_server_ip="127.0.0.1"
mail_server_port="25"
recipient="sryan@example.com"
sender="\"Ubuntu Server\"<ubuntu@example.com>"
nc ${mail_server_ip} ${mail_server_port} << EOF
ehlo example.com
mail from:${sender}
rcpt to:${recipient}
data
From:${sender}
To:${recipient}
subject: Telnet test
${my_email_body}
.
quit
EOF
@omexlu
Copy link

omexlu commented Jan 13, 2021

This don't work anymore i get:
550 5.5.1 Protocol error
554 5.5.1 Error: no valid recipients

For few days it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment