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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content