m**v 发帖数: 373 | 1 新手,mysql在centos下。
我想建立一个script,这个script登录到mysql,
执行一个query,然后把结果email出来。
大家指点一下? |
h*******c 发帖数: 248 | 2 echo "SELECT .... " |mysql -u username --password=password
databasename|mailx -s subject y*******[email protected]
【在 m**v 的大作中提到】 : 新手,mysql在centos下。 : 我想建立一个script,这个script登录到mysql, : 执行一个query,然后把结果email出来。 : 大家指点一下?
|
m**v 发帖数: 373 | 3 多谢了!
email给local user可以,可是总是发不到外面的
address比如gmail.com,我的linux是在我自己的XP里面的一个VM,
有什么办法?
【在 h*******c 的大作中提到】 : echo "SELECT .... " |mysql -u username --password=password : databasename|mailx -s subject y*******[email protected]
|
h*******c 发帖数: 248 | 4 If in general your linux box can't send mail to outside world, I don't
have a command to do that. However if you know your smtp server (it's
likely provided by your ISP), you can write a short "perl" to do that.
you may read
http://perldoc.perl.org/Net/SMTP.html
Or
http://serverfault.com/questions/38919/send-an-email-with-an-attached-
file-using-telnet-or-netcat
for simply using telnet
【在 m**v 的大作中提到】 : 多谢了! : email给local user可以,可是总是发不到外面的 : address比如gmail.com,我的linux是在我自己的XP里面的一个VM, : 有什么办法?
|
j**********8 发帖数: 189 | 5 install mutt , postfix or sendmail
【在 m**v 的大作中提到】 : 多谢了! : email给local user可以,可是总是发不到外面的 : address比如gmail.com,我的linux是在我自己的XP里面的一个VM, : 有什么办法?
|
J********a 发帖数: 5208 | 6 mutt + gmail is the key
but not very secure
【在 j**********8 的大作中提到】 : install mutt , postfix or sendmail
|
N**********d 发帖数: 9292 | 7 mysql -uUSERNAME -pPASSWORD -Ddatabasename -e "select ....." > filename
然后用可用的Email软件发送就好了
【在 m**v 的大作中提到】 : 新手,mysql在centos下。 : 我想建立一个script,这个script登录到mysql, : 执行一个query,然后把结果email出来。 : 大家指点一下?
|
m**v 发帖数: 373 | 8 安装了mutt,根据这里设置.muttrc文件
http://tuxtraining.com/2009/01/24/using-gmail-with-mutt-the-minimal-way-imap-update
运行mutt的时候出错:
Error in /root/.muttrc, line 3: smtp_url: unknown variable
Error in /root/.muttrc, line 4: smtp_pass: unknown variable
Error in /root/.muttrc, line 12: header_cache: unknown variable
Error in /root/.muttrc, line 13: message_cachedir: unknown variable
source: errors in /root/.muttrc
难道这些variable不合法?
【在 J********a 的大作中提到】 : mutt + gmail is the key : but not very secure
|
R****a 发帖数: 199 | 9 depends on your setting, but you can try the following:
in shell, use the command,
mysql --database=$dbname -p$pswd -e "$yourquer" > $outputfile
Then you try to send this output file to a mail recipient.
【在 m**v 的大作中提到】 : 新手,mysql在centos下。 : 我想建立一个script,这个script登录到mysql, : 执行一个query,然后把结果email出来。 : 大家指点一下?
|