31,703
edits
Line 106: | Line 106: | ||
This next method is superior when sending longer messages. Instead of using the echo command, we'll store our email header and body information into a text file. Just as in the example above, lets send an email from the hypothetical address '''[email protected]''' to '''[email protected]''' using Gmail's SMTP settings, but without using echo: | This next method is superior when sending longer messages. Instead of using the echo command, we'll store our email header and body information into a text file. Just as in the example above, lets send an email from the hypothetical address '''[email protected]''' to '''[email protected]''' using Gmail's SMTP settings, but without using echo: | ||
:~# sendmail -v -H "exec openssl s_client -quiet -connect smtp.gmail.com:587 -tls1 -starttls smtp" <span style=color:red>'''<mail.txt'''</span> -f [email protected] -au"[email protected]" -ap"pass"[email protected] | :~# sendmail -v -H "exec openssl s_client -quiet -connect smtp.gmail.com:587 -tls1 -starttls smtp" <span style=color:red>'''</tmp/mail.txt'''</span> -f [email protected] -au"[email protected]" -ap"pass"[email protected] | ||
As you can see, instead of using echo, we're using <span style=color:red>'''</tmp/mail.txt'''</span>, which is the path the '''mail.txt''' file that stores the email's header and body. This file does not exist in the router, therefore, you should create it yourself. To create a file, use the '''touch''' command: | |||
:~# touch /tmp/mail.txt | |||
This will create and empty text file called mail.txt in the '''/tmp/''' directory. Feel free to name this file whatever you like just keep in mind that you'll have to modify the given command accordingly. | |||
To edit the newly create file, use the '''vi''' command: | |||
:~# vi /tmp/mail.txt | |||
When using ''vi'' pres the '''i''' key on your keyboard to start editing. To finish editing and save changes press the "Escape" button, type ''':x''' and press "Enter": | |||
[[File:Vi text file.png]] |