Advertisement
chotoipho

BASH: Send email via curl command (gmail example)

Jul 29th, 2015
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.46 KB | None | 0 0
  1. curl smtps://smtp.gmail.com:465 -v --ssl --mail-from "SENDER@gmail.com" --mail-rcpt "RECIPIENT@gmail.com" --user SENDER@gmail.com:SENDER_PASSWORD --upload-file /tmp/mail.txt
  2.  
  3.  
  4. * For gmail accounts, must enable access for less secure apps at https://security.google.com/settings/security/activity.
  5.  
  6.  
  7.  
  8. [user@computer tmp]$ cat mail.txt
  9. From: "User Name" <username@gmail.com>
  10. To: "John Smith" <john@example.com>
  11. Subject: This is a test
  12.  
  13. Hi John,
  14. I'm sending this
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement