Em Seg, 2004-04-12 às 08:10, Gustavo Moda (Yahoo) escreveu:
> Amigos,
>
> Como configurar meu linuz para enviar e-mail diretamente por um SMTP via
> shell.
> Quero me conectar no smtp na porta 25 enviar os comandos e sair fora.
> Tem como?
>
> Abraços
Eu tava dando uma passeada por ai, como aqui no trampo é uma LAN eu uso
o Pine, nunca tentei acessar de fora mas blz... eu acabei achando um
script por ai no site VivaOLinux.. é muito bom esse site
Os créditos estão em anexo ao código fonte, não tentei usar mas parece
funcionar, boa sorte..
--------------------------COMEÇA AQUI------------------------------
#! /bin/sh
#
# Name: mailnow.sh
# Description: Send email with SMTP in line shell
#
# Send mail via telnet - SMTP
# This script based in one help of the (Fernando Hallberg)
# in list-mail <[EMAIL PROTECTED]>
#
# Original author: Wanderley Guimarães <[EMAIL PROTECTED]>
# Date : 2003/11/27 20:44:55
#
# Set variables
NAME_SMTP="smtp.uol.com.br"
IP_SMTP=`ping -c 1 $NAME_SMTP | head -n 1 | cut -d"(" -f2 | cut -d")"
-f1`
# It verifies if the correct parameters
if [ "$1" = "" ]
then
echo "Send email via telnet - $NAME_SMTP: $IP_SMTP"
echo "Usage: $0 [-ft] <from> <to> <subject> <file or text>"
echo "Options: -f text be in file"
echo " -t single text"
echo
echo "This script based in one help of the (Fernando Hallberg) list"
echo "[EMAIL PROTECTED]"
exit 1
fi
if [ "$1" = "-f" ]
then
MENSAGE=`cat $5`
else
if [ "$1" = "-t" ]
then
MENSAGE=$5
else
echo "Invalid option."
exit 1
fi
fi
# Send mensage
echo -e "helo $NAME_SMTP\r\nmail from: <$2>\r\nrcpt to:
<$3>\r\ndata\r\nSubject: $4\r\n\r\n$MENSAGE\r\n.\r\n" >
/dev/tcp/$IP_SMTP/25
----------------------------TERMINA AQUI-----------------------------
(não sei pra que botar isso...)
falow
AMIM M. SALUM KNABBEN
GNU/Linux, não são apenas as portas que se abrem!
---------------------------------------------------------------------------
Esta lista � patrocinada pela Conectiva S.A. Visite http://www.conectiva.com.br
Arquivo: http://bazar2.conectiva.com.br/mailman/listinfo/linux-br
Regras de utiliza��o da lista: http://linux-br.conectiva.com.br
FAQ: http://www.zago.eti.br/menu.html