https://github.com/PF4Public/fetchmail
[root@mail ~]# yum install fetchmail
[root@mail ~]# cd /usr/share/roundcubemail/plugins/ [root@mail plugins]# unzip fetchmail-master.zip
fetchmail.php 及 class 名稱不同,必須改成 fetchmail。
[root@mail plugins]# ls fetchmail-master composer.json fetchmail.js localization skins config.inc.php.dist fetchmail.php README.md SQL [root@mail plugins]# mv fetchmail-master fetchmail
fetchmail 插件。
[root@mail plugins]# vim /etc/roundcubemail/config.inc.php
[root@mail plugins]# grep fetchmail /etc/roundcubemail/config.inc.php
$config['plugins'] = array('fetchmail',# 'pop3fetcher',
[root@mail fetchmail]# mysql -uroot -p roundcube < SQL/mysql.initial.sql Enter password:
[root@mail plugins]# cd fetchmail [root@mail fetchmail]# wget https://sourceforge.net/p/postfixadmin/code/HEAD\ /tree/trunk/ADDITIONS/fetchmail.pl?format=raw \ --no-check-certificate -O fetchmail.pl
[root@mail fetchmail]# diff -uN fetchmail.pl.orig fetchmail.pl --- fetchmail.pl.orig 2016-06-06 14:14:55.335002899 +0800 +++ fetchmail.pl 2016-06-06 14:25:48.907678523 +0800 @@ -14,17 +14,17 @@ # database settings # database backend - uncomment one of these -our $db_type = 'Pg'; -#my $db_type = 'mysql'; +#our $db_type = 'Pg'; +my $db_type = 'mysql'; # host name our $db_host="127.0.0.1"; # database name -our $db_name="postfix"; +our $db_name="roundcube"; # database username -our $db_username="mail"; +our $db_username="roundcube"; # database password -our $db_password="CHANGE_ME!"; +our $db_password="XXXXXXXXX"; # instead of changing this script, you can put your settings to /etc/mail/postfixadmin/fetchmail.conf # just use perl syntax there to fill the variables listed above (without the "our" keyword). Example:
@@ -83,7 +83,7 @@
if($db_type eq "Pg") {
$sql_cond = "active = 1 AND date_part('epoch',now())-date_part('epoch',date)";
} elsif($db_type eq "mysql") {
- $sql_cond = "active = 't' AND unix_timestamp(now())-unix_timestamp(date)";
+ $sql_cond = "active = 1 AND unix_timestamp(now())-unix_timestamp(date)";
}
$sql = "
@momainname 會自動加入 @localhost,但這會造成信件無法無法傳送到 username@localhost,所以。
@@ -96,6 +96,7 @@
map{
my ($id,$mailbox,$src_server,$src_auth,$src_user,$src_password,$src_folder,$fetchall,$keep,$protocol,$mda,$extra_options,$usessl,$sslcertck,$sslcertpath,$sslfingerprint)=@$_;
+ $mailbox.='@'.$ENV{'HOSTNAME'};
syslog("info","fetch ${src_user}@${src_server} for ${mailbox}");
$cmd="user '${src_user}' there with password '".decode_base64($src_password)."'";
[root@mail fetchmail]# chown mail.mail fetchmail.pl [root@mail fetchmail]# chmod 700 fetchmail.pl [root@mail fetchmail]# ll fetchmail.pl -rwx------. 1 mail mail 3940 Jun 6 14:25 fetchmail.pl
[root@mail fetchmail]# vim /etc/cron.d/fetchmail [root@mail fetchmail]# cat /etc/cron.d/fetchmail */5 * * * * mail /usr/share/roundcubemail/plugins/fetchmail/fetchmail.pl
[root@mail fetchmail]# diff -uN ../fetchmail-master/fetchmail.php fetchmail.php --- ../fetchmail-master/fetchmail.php 2016-05-16 23:56:37.000000000 +0800 +++ fetchmail.php 2016-06-06 20:18:35.808930991 +0800 @@ -239,6 +239,7 @@ 'id' => $field_id ) ); $input_fetchmailpollinterval->add ( array ( + '3', '5', '10', '15', @@ -247,6 +248,7 @@ '30', '60' ), array ( + '3', '5', '10', '15',
[root@mail fetchmail]# diff -uN ../fetchmail-master/skins/default/fetchmail.css skins/default/fetchmail.css
--- ../fetchmail-master/skins/default/fetchmail.css 2016-05-16 23:56:37.000000000 +0800
+++ skins/default/fetchmail.css 2016-06-06 20:16:26.698405723 +0800
@@ -3,7 +3,7 @@
background-color: #F9F9F9;
height: 163px;
overflow: auto;
- width: 450px;
+ width: 650px;
}
body.fetch-table {
@@ -42,7 +42,7 @@
#myprefs {
/* border: 1px solid #909090 !important;*/
- width: 480px;
+ width: 680px;
padding-top: 12px;
padding-left: 12px;
padding-bottom: 6px;