Sending an email from command line in Ubuntu 12.04

Reading time ~1 minute

mail is a utility that can sends an email from command line. In Ubuntu 12.04, the following command sends an email to to@domain.com with empty body.

$ mail -s "mail test" -S replyto="replyto@domain.com" to@domain.com < /dev/null
  • -s: specify subject on command line.
  • -S: set variable. In this case, a variable replyto is set to replyto@domain.com. When a recipient of this email clicks ‘Reply to’ button on their client, the client will set To address to replyto@domain.com, instead of From address from the original mail.

(Note: options vary depending on the version of Ubuntu distribution.)

mail reads its body from standard input. An email sent by this command has empty body because /dev/null is used as body.

kiwi campus

가족여행차 샌 프란시스코에 갔다가 오랜만에 버클리 교정을 구경하러 갔다.돌아다니다보니 Sather gate 근처의 분수대 주변에 이런 게 돌아다니고 있었다.처음엔 학생이 만든 장난감 정도로 생각했다. 폰에 외장(?)렌즈를 달아서 꽂아놨는데 이게 ...… Continue reading