This is an old revision of the document!


Table of Contents

Overview

telnet

Please follow the instruction to send a mail via telnet:

------
Mailserver testing
------
telnet localhost 25
.
.
.
helo testmail.org (Identify and demanding SMTP-Modus)
mail from:test@testmail.org (addressor/ sender)
rcpt to:test_receiver@linux.de (Receiver)
data (enables to write mailcontent)
.    (quit insert mode)
QUIT (close session)

Tip:
reset enable to send addtional emails

Note: There´s “helo” and “ehlo”. Difference:

“helo” = Welcome to the server

“ehlo” = Enhanced HELO

mail

An email can be send from comandline with the progamm “mail”.

Example:

MAILADDR=myemail@test.de
echo "Test" | mail -s "Another Test" ${MAILADDR}
echo "Test" | mail -s "Another Test for ${HOST} - `date`" ${MAILADDR} -a "FROM: mail@domain.org"                 #Include sender-adress
echo "Test" | mail -s "Another Test for ${HOST} - `date`" ${MAILADDR} -r "mail@test.de"                          #Include sender-adress "mail@test.de" for newer "mail" version

sendmail

Another way to send mails via commandline/ scripts:

First you have to create a file called “text” with example content:

To: username@domain.com
Subject: any-text
From: username@domain.com

Any mail content!

Note: There must be an empty line between “From:” and “Content”!!

Create a executable script (e.g. permission 755) to send the mail (also to run it with cronjobs for automatism):

#!/bin/bash

/bin/cat /scripts/text | /usr/sbin/sendmail -t

Another way:

#!/bin/bash

/bin/cat <<EOF | /usr/sbin/sendmail -t
To: username@domain.com
Subject: any-text
From: username@domain.com

Any mail content!
EOF

wall

To send a notification to local connected users:

echo "SYSTEM BEING SHUT DOWN IN 5 MINUTES" | wall                                                                #Message to local connected users
linux/mail.1517850412.txt.gz · Last modified: 2018/02/05 18:06 by tmade
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki