Using telnet to send test emails over smtp fails when using stdin-redirection (pipes or heredocs)

Solution Verified - Updated -

Issue

  • I'm using a script that tests smtp email connectivity. The script uses the telnet command and worked in HP-UX but I can't get it to work in RHEL ... it always fails.

    telnet mailserver 25 <<EOF
    HELO        xxxx
    MAIL FROM:  xxxx
    RCPT TO:    xxxx
    SUBJECT:    xxxx
    DATA
    From:       xxxx
    To:         xxxx
    Subject:    xxxx
    xxxxx (body here) xxxx
    .
    QUIT
    EOF
    

Environment

  • Red Hat Enterprise Linux
  • telnet command

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.