Jump to content

Sending emails via command line: Difference between revisions

Line 72: Line 72:
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>Hello,</span><span style=color:red>\n\n</span><span style=color:blue>JustTesting</span>"''' part:
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>Hello,</span><span style=color:red>\n\n</span><span style=color:blue>JustTesting</span>"''' part:


'''echo''' - prints the specified arguments to stdout
* '''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 style=color:green>'''-e'''</span> - makes the echo command interpret backslash escapes (</span><span style=color:red>\n</span> in this case)


<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.
* <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.


The text highlighted in blue specifies the mail's header information (excluding the recipient's address) and body. In our case it represents this:
The text highlighted in blue specifies the mail's header information (excluding the recipient's address) and body. In our case it represents this: