Можете ли вы использовать sendmail
? Если да:
mymachine $ sendmail user@example.com <<EOM
> To: user@example.com
> From: me@example.com
> Subject: Test mail `date +"%x %H:%M"`
> Importance: high
> X-Priority: 1 (Highest)
> X-MSMail-Priority: High
>
> Test message
> EOM
mymachine $
Текст после >
будет набран на новой строке. Конечно, вы можете просто вставить текстовый файл:
mymachine $ cat > message
> To: user@example.com
> From: me@example.com
> Subject: Test mail `date +"%x %H:%M"`
> Importance: high
> X-Priority: 1 (Highest)
> X-MSMail-Priority: High
>
> Test message
## CTRL+D ##
mymachine $ cat message | sendmail user@example.com