Changes

no edit summary
Line 20: Line 20:  
Once you have all the necessary email information, choose your favourite method of sending command line queries or the one that is currently available to you and log in to your router accordingly. The most common methods of doing so are '''[[CLI]]'''('''Command Line Interface''') and SSH.
 
Once you have all the necessary email information, choose your favourite method of sending command line queries or the one that is currently available to you and log in to your router accordingly. The most common methods of doing so are '''[[CLI]]'''('''Command Line Interface''') and SSH.
    +
'''Note''': in further examples of this guide we will be demonstrating how to send email using SSH. Feel free to follow the guide step by step whichever method you choose, because the commands used are identical and the only thing that is different is the GUI (Graphical User Interface).
 
===CLI===
 
===CLI===
 
----
 
----
Line 56: Line 57:     
Once this is done, you will able to execute commands via SSH.
 
Once this is done, you will able to execute commands via SSH.
 +
 +
==Sending emails==
 +
 +
RUT routers use the '''sendmail''' program to send emails. sendmail is a very simple MTA (Mail Transfer Agent), which implements the SMTP (Simple Mail Transfer Protocol) amongst others and can be used to transmit emails, typically on Linux dedicated or virtual servers.
 +
 +
There is no need to install anything else, because RUT routers have sendmail implemented in their Firmware. So, if you followed the steps above, you should be ready to send emails via command line.
 +
 +
===Method 1===
 +
----
 +
For this first example, lets send an email from the hypothetical address '''[email protected]''' to '''[email protected]''' using Gmail's SMTP settings:
 +
 +
echo -e "subject:Test\nfrom:[email protected]\nTesting" | sendmail -v -H "exec openssl s_client -quiet -connect smtp.gmail.com:587 -tls1 -starttls smtp" -au"[email protected]" -ap"senders.email.password" [email protected]
 +
 +
Let's examine this command in detail. First, the '''echo <span style=color:green>-e</span> "<span style=color:blue>subject:Test</span><span style=color:red>\n</span><span style=color:blue>from:[email protected]</span><span style=color:red>\n</span><span style=color:blue>Testing</span>"''' part:
 +
 +
'''echo''' - prints the specified arguments to stdout
 +
 +
'''<span style=color:green>-e</span>''' - makes the echo command interpret backslash escapes (</span><span style=color:red>\n</span> in this case)
 +
 +
</span><span style=color:red>\n</span> - the end line symbol, i.e., it indicates that the following text begins in another line. The </span><span style=color:red>\n</span> part itself is not interpreted as part of the text if '''<span style=color:green>-e</span>''' is specified.
 +
 +
 +
 +
sendmail -v -H "exec openssl s_client -quiet -connect smtp.gma
 +
il.com:587 -tls1 -starttls smtp" <mail.txt -f [email protected] -au"d
 +