Jump to content

Sending emails via command line: Difference between revisions

Line 70: Line 70:
  echo -e "subject:Test\nfrom:[email protected]\nHello,\n\nJustTesting" | 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]
  echo -e "subject:Test\nfrom:[email protected]\nHello,\n\nJustTesting" | 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>Hello,</span><span style=color:red>\n\n</span><span style=color:blue>JustTesting</span>"''' part:
Let's examine this command in detail. First, this part:
 
'''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>"'''  


* '''echo''' - prints the specified arguments to stdout
* '''echo''' - prints the specified arguments to stdout
Line 86: Line 88:
   
   
  JustTesting</span>  
  JustTesting</span>  
 
So, in short, the part beginning with '''echo''' and ending just before the column ('''|''') represents the email's header and body of text. Now lets The next part (after the column
sendmail -v -H "exec openssl s_client -quiet -connect smtp.gma
sendmail -v -H "exec openssl s_client -quiet -connect smtp.gma
il.com:587 -tls1 -starttls smtp" <mail.txt -f [email protected] -au"d
il.com:587 -tls1 -starttls smtp" <mail.txt -f [email protected] -au"d