⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendmail.pl

📁 vpn虚拟专用网络的一个开源搭建工具
💻 PL
字号:
#!/usr/bin/perluse Mail::Sendmail;############################################################# Modify the following 4 variable to match your environment############################################################$dbHost = "localhost";         # your SF mysql db hostname goes here, i.e. mysql4-j$dbUser = "root";         # your rw or admin db user name goes here$dbUserPassword = "whatever_u_want"; # your password goes here$dbDatabase = "vpn";     # your mysql database name goes here. i.e. j89169_drupal$mailFrom = "VPN Community <noreply\@ovpnwc.sourceforge.net>";## Should not have to modify any of the blow code or variables#$dbTable = "email";$mysql = "/usr/bin/mysql";$mysqlCmd = "$mysql ";$mysqlCmd .= "-h $dbHost ";$mysqlCmd .= "-u $dbUser ";$mysqlCmd .= "--password=$dbUserPassword ";$mysqlCmd .= "$dbDatabase";# Get a list of messages$cmd = qq#echo "SELECT id FROM $dbTable" | $mysqlCmd#;chop(@messageList = `$cmd`);# Get rid of the first entry, its column headershift(@messageList);## Iterate through all the message indexes#foreach(@messageList) {        %mail = ( To      => query($_, "receiver"),				  From    => $mailFrom,                  Subject => query($_, "subject"),                  Message => query($_, "body")                );        sendmail(%mail) or die $Mail::Sendmail::error;}## Now remove all sent message from table so we don't try to# send them again on the next run.#$cmd = qq#echo "DELETE from email" | $mysqlCmd#;`$cmd`;sub query {        my($id, $col) = @_;        $cmd = qq#echo "SELECT $col FROM $dbTable WHERE id=$id" | $mysqlCmd#;        chop(my @r = `$cmd`);        my $body = $r[1];        $body =~ s/\\n/\n/g;        return $body;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -