incmc said:
Hi!
Ich bin dabei den Exim hier aufzusetzten. Nun muss ich von dem server aus mal eine mail lokal an mich selber schicken (die Absender IP brauche ich zum testen), weiss aber nicht wie das geht.
Kurzer Tipp?
Gruß, incmc
mmh, so könnt's gehen, wenn du's per telnet testen willst:
################################
#!/bin/sh
smtpconfig ()
{
SMTP_SOURCE=deine mail
#SMTP_DEST="testuser@domain"
SMTP_DEST="dein empfänger"
# SMTP_DEST=$SMTP_SOURCE
SMTPHOST=localhost
SMTPMYSELF=hostname.deine.domain
# SMTPMESSAGE will contain the name of a function which generates the body of
# the mail!
SMTPMESSAGE=smtpfunc
}
# This function will generate the core
smtpfunc ()
{
cat <<EOF
From: $SMTP_SOURCE
To: $SMTP_DEST
Date: $(date)
Subject: SUBJECT
DATEN
EOF
sleep 1
}
smtpunconfig ()
{
unset SMTP_SOURCE SMTP_DEST SMTPHOST SMTPMYDOMAIN
}
smtpecho ()
{
[ -z "$*" ] && echo && sleep 1 && return
echo -e $*
sleep 1
}
smtpendmsg ()
{
cat <<EOF
.
EOF
sleep 1
}
do_raw_smtp ()
{
# This function should be only used by do_smtp !!
# check if everything is configured correctly
[ -z "$SMTP_SOURCE" -o -z "$SMTP_DEST" -o -z "$SMTPMYSELF" ] &&
{
# Just exit with bad return code !
# Environent was not correct.
return 1
}
# Initial sleep used to allow to Telnet to connect!
sleep 2
smtpecho "HELO $SMTPMYSELF "
smtpecho "MAIL FROM:<${SMTP_SOURCE}>"
for i in $SMTP_DEST;
do smtpecho "RCPT TO:<${i}>"
done
smtpecho "DATA"
# Now send the actual data
smtpfunc
sleep 1
smtpendmsg
smtpecho "QUIT"
# Message has been send by now!!
#
}
do_smtp ()
{
# Let's verify if SMTP environment configured!
# If not let's configure it ....
[ -z "$SMTPHOST" ] && smtpconfig
# Let's do the magic now
( do_raw_smtp & ) | telnet $SMTPHOST 81
echo
echo Completed...
echo
echo "If it didn't work increase connection delay !!"
echo
}
do_smtp
###############################
oder du kannst auch mal in man mail" bzw. "man sendmail" gucken (habe selbst kein exim im einsatz, sollte aber funktionieren).