2017-02-01 6 views
0

私は以下のようなテーブルを持っています。データベースからデータを取得し、unixスクリプトを使用して電子メールで送信してください

Partner_id Transmission_id Filename Email_Contact 
Partner1  123    file1  [email protected] 
Partner1  456    file2  [email protected] 
partner1  987    file3  [email protected] 
partner2  532    file4  [email protected] 
partner2  234    file5  [email protected] 
partner3  795    file6  [email protected] 
partner3  367    file7  [email protected] 

私は、データベースからデータを取得し、電子メールアドレスにファイル名を送信するためにUNIXスクリプトを書いています。 例:partner1の場合、body1にfile1、file2、file3、subjectにpartner1を含む[email protected][email protected]に1通の電子メールを送信する必要があります。 私はUNIXでうまくいきません。助けてください

ありがとうございます。

答えて

0

#!bin/bash Partner_ID=$(sqlplus -s [email protected]/dbpassword <<END SELECT Partner_id FROM table name; END ) file_name=$(sqlplus -s [email protected]/dbpassword <<END SELECT Filename FROM table name; END ) email_ID=$(sqlplus -s [email protected]/dbpassword <<END SELECT Email_Contact FROM table name; END ) echo '$file_name' | mail -s '$Partner_ID' $email_ID

...それがお役に立てば幸い
関連する問題