Created
March 23, 2012 03:36
-
-
Save chimerast/2166514 to your computer and use it in GitHub Desktop.
/usr/sbin/sendmailをつかってシェルスクリプトからメールを簡単に送る
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PROGRAM=`basename $0` | |
MAILTO="test@example.com" | |
MAILFROM=$USER@$HOSTNAME | |
function sendmail { | |
read -rd '' BODY | |
/usr/sbin/sendmail -t << EOF | |
To: $MAILTO | |
From: $PROGRAM at $HOSTNAME <$MAILFROM> | |
Subject: $1 | |
$BODY | |
EOF | |
} | |
sendmail "メールのタイトル" << EOF | |
メール本文 | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment