标签 iredmail 下的文章

iredmail - 通过 curl 来增加域名

需求:从一个含用域名列表的文本文件中逐行读取,通过 curl 提交给 iredadmin

尝试:

##
# Configurations.
##

rm tmpcs.txt
rm cookie

# Path to temporary file which will store your cookie data.
cookie_path=cookie

username=postmaster@anqun.org
password=ps88888888
login_url="https://mail.anqun.org/iredadmin/login"
create_url="https://mail.anqun.org/iredadmin/create/domain"
# action_url="$create_url/$domainname"

##
# Logic. Most likely you shouldn't change here anything.
##

curl -i -b $cookie_path -c $cookie_path -d "username=$username&password=$password" "$login_url"

curl -i -b $cookie_path -c $cookie_path -o tmpcs.txt --request GET "$create_url"

csrf_token=$(grep -oP '(?<=<input type="hidden" name="csrf_token" value=")[^"]*' tmpcs.txt)


while read -r line; do
   # 使用该行内容作为变量值来执行 cURL 命令
   data="csrf_token=$csrf_token&domainName=$line&cn=&submit_add_domain=Add"
   curl -i --cookie cookie --data "${data}" "$create_url"
done < domain.txt

roundcube - 收件箱列表为空 - the list is empty - imap - vsz_limit 256 MB

现象:某个邮箱用户登录到 roundcube webmail,收件箱列表是空的。原先的邮件数约有十万封。

实践:查看 dovecot 的 imap.log ,出现类似 (Out of memory (service imap { vsz_limit=256 MB }, you may need to increase it)) 的字样。按网上的例子,在 /etc/dovecot/dovecot.conf 添加如下内容后,重启 dovecot 服务即可。

service imap {
  vsz_limit = 1024MB
}

参考:https://forum.iredmail.org/topic11051-increasing-vszlimit.html

在 FreeBSD 13.2 里尝试安装 iRedMail 1.6.8 - 放弃

原因:看到 iRedMail 群里有人说在 FreeBSD 13.2 里安装出错,提示如:

lsof-4.99.3_1,8 requires kernel sources.
error code 1
stop.
make stopped in /usr/ports/sysutils/lsof
error code 1
stop
make stooped to /usr/ports/devel/py-Jinjia2
error failed to downloading package, please fix it manually and then relaunch iRedMail installer.

我在一台国外的机子,配置是 Atom C2750, 8GB 内存里测试 iRedMail 的安装。遇到同样的报错信息。虽然可以手工下载 ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/13.2-RELEASE/src.txz 后继续安装,但通过 ports 编译软件,所需的时间太长了。过了约24小时,还没完成,当前界面信息停留在:

l' -Cprefer-dynamic -Z binary-dep-depinfo -L native=/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage0-rustc/x86_64-unknown-freebsd/release/build/psm-d1aad399e5dbb6f5/out -L native=/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage0-rustc/x86_64-unknown-freebsd/release/build/rustc_llvm-938455d976a8c95f/out -L native=/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/llvm/build/lib`
    Building [=======================> ] 316/323: rustc_driver_impl

但我不想等待结果,放弃了。

-- Build files have been written to: /usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/lld/build
running: cd "/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/lld/build" && DESTDIR="" "cmake" "--build" "." "--target" "install" "--config" "Release" "--" "-j" "1"
[  1% 3/127] Building CXX object Common/CMakeFiles/lldCommon.dir/CommonLinkerContext.cpp.o^C
ninja: build stopped: interrupted by user.

Build completed unsuccessfully in 14:46:49
*** Error code 1
*** Signal 2

参考:

debian 12.2系统里安装 iredmail-enterprise-1.0-beta1-linux-amd64 的两个问题

尝试在debian 12.2系统里安装 iredmail-enterprise-1.0-beta1-linux-amd64。发现有两个问题:

  1. web安装程序报错。搜索得,ntp 包对应的服务名是 ntpsec ,不是ntp 。 服务配置文件是:/lib/systemd/system/ntpsec.service
    TASK [ntp] Install ntp/chrony server to sync local time.
    ok: ntp

    TASK [ntp] Enable and restart ntp/chrony service.
    failed: ntp
    [ERROR] task error: failed in restarting service ntp: exit status 5, Failed to restart ntp.service: Unit ntp.service not found.

  2. 通过web/admin 管理添加的用户,外网发信到这个用户会报错:said: 550 5.1.1 mailto:liu@iredmail.anqun.org: Recipient address rejected: User unknown (in reply to RCPT TO command) 这个用户是能登录到 roundcube。从服务器的shell里,也能通过命令行成功发信。作为对比,用web/iredadmin添加的用户,正常。删除之前报错的域,重新使用iredadmin添加回同一个域和用户,能从外网收信。尝试的解决方法是手动补上缺失的 forwardings 表内容:
    INSERT INTO forwardings (address, forwarding, domain, dest_domain, is_forwarding)
    VALUES ('liu@iredmail.anqun.org', 'liu@iredmail.anqun.org','iredmail.anqun.org', 'iredmail.anqun.org', 1);

参考:

iredmail - 批量创建邮箱账户 - 从csv文件生成mysql数据库查询文件

需求:如需从给定的,其中包含邮箱地址和密码的 csv 文件中创建邮箱账户,怎么操作?

尝试:如下例,

#!/bin/bash

rm -f ./users.sql

awk -F',' '!seen[$1]++ { print }' users.csv > output.csv

while IFS=, read -r email password; do
bash /root/iRedMail-1.6.7/tools/create_mail_user_SQL.sh "${email}" "${password}" >> ./users.sql
done < ./output.csv

mysql --force vmail < ./users.sql

echo "创建完成。"

参考:https://docs.iredmail.org/sql.create.mail.user.html