2013-11-21 28 views
6

メッセージと添付ファイルを含むすべての連絡先に電子メールを送信するbashスクリプトを作成しようとしています。これは悪意のある目的のためではありません。Mac端末が添付ファイル付きで電子メールを送信

どうすればいいですか?これは可能ですか?前もって感謝します。私は以前、これを達成するためにuuencodeを使用している

+0

」ですあなたのために保存されたすべての連絡先 "?これはアドレス帳アプリケーションの連絡先ですか?これにリンゴスクリプトを使用することを検討しましたか? – Floris

答えて

9

uuencode source.txt destination.txt | mail -s "subject of mail" [email protected] 

あなたはbashスクリプトでこれを使用することができます。サンプル:

tell application "Mail" 
    tell (make new outgoing message) 
     set subject to "subject" 
     set content to "content" 
     -- set visible to true 
     make new to recipient at end of to recipients with properties {address:"[email protected]", name:"Name"} 
     make new attachment with properties {file name:(POSIX file "/tmp/test.txt")} at after the last paragraph 
     send 
    end tell 
end tell 

あなたはシェルから引数を渡すために、明示的な実行ハンドラを使用することができます:あなたはまた、AppleScriptを使用する場合があります

uuencode /usr/bin/xxx.c MyFile.c | mail -s "mailing my c file" [email protected] 

http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds5/uuencode.htm

+0

私はfile.txtをどのように置き換えるのですか? 〜/ Path/To/file.txt?なぜ2つあるのですか? –

+0

短い返信をおかけして申し訳ありません... uuencodeへの最初の引数はsourceで、2番目の引数は宛先ファイル名....ですので、好きな場合は:uuencode source.txt destination.txt | mail -s "subject" [email protected]これはローカルシステムからあなたのsource.txtをあなたの電子メールIDにfile.txtという名前で送るでしょう – Kush

+0

ありがとう。 また、連絡先リストの全員に電子メールを送信するように、どうすればいいですか? –