事前準備
取り込み予定のメールサーバーにalfrescoユーザーに設定したメールアドレスからのメールが含まれていると、「EMAIL_CONTRIBUTORSに設定されていない」と判定され、配送エラーとなり、postfixからバウンスエラーのメールが出されます。あらかじめalfrecoユーザーに設定したアドレスは、独自のものに変更しておく必要があります。
1.global-properties.sampleからメール関連を抜粋・追加
①以下を抜粋
#
# Alfresco Email Service and Email Server
#-------------
# Enable/Disable the inbound email service. The service could be used by processes other than
# the Email Server (e.g. direct RMI access) so this flag is independent of the Email Service.
#-------------
#email.inbound.enabled=true
# Email Server properties
#-------------
#email.server.enabled=true
#email.server.port=25
#email.server.domain=alfresco.com
#email.inbound.unknownUser=anonymous
# Alfresco Email Service and Email Server
#-------------
# Enable/Disable the inbound email service. The service could be used by processes other than
# the Email Server (e.g. direct RMI access) so this flag is independent of the Email Service.
#-------------
#email.inbound.enabled=true
# Email Server properties
#-------------
#email.server.enabled=true
#email.server.port=25
#email.server.domain=alfresco.com
#email.inbound.unknownUser=anonymous
②global.propertiesとして追加
vi tomcat/shared/classes/alfresco-global.properties
上記②のサンプルを以下に貼付、青字の部分を変更
### Begin - Custom user properties - ANSIBLE MANAGED BLOCK
# Add your properties here
# Enable/Disable the inbound email service. The service could be used by processes other than
# the Email Server (e.g. direct RMI access) so this flag is independent of the Email Service.
#-------------
email.inbound.enabled=true //メール受信を行う
# Email Server properties
#-------------
email.server.enabled=true //smtpサーバを起動する
email.server.port=1025 //受信ポートを指定 25だとpostfixなどのMTAと干渉するため変更
email.server.domain=xxxxxx.com //ドメインを指定
email.inbound.unknownUser=admin //受信ユーザーを指定 後の設定上上位権限をもつユーザーを指定
# Add your properties here
# Enable/Disable the inbound email service. The service could be used by processes other than
# the Email Server (e.g. direct RMI access) so this flag is independent of the Email Service.
#-------------
email.inbound.enabled=true //メール受信を行う
# Email Server properties
#-------------
email.server.enabled=true //smtpサーバを起動する
email.server.port=1025 //受信ポートを指定 25だとpostfixなどのMTAと干渉するため変更
email.server.domain=xxxxxx.com //ドメインを指定
email.inbound.unknownUser=admin //受信ユーザーを指定 後の設定上上位権限をもつユーザーを指定
sudo systemctl restart tomcat.service
2.Shareの設定
①アスペクトの管理→Eメールエイリアスを追加
getmailで取得したメールをpostfixを経由して、alfrescoに配送します。
3.postfixをインストール・設定
有料版はsmtpの制御ができますが、community版はできません。送信先フォルダにスクリプトが設定された状態でそのまま配送すると、alfresco側で処理しきれず、配送エラーや0byte配送を起こします。そのため、postfixに遅延処理の設定を追加します
インストール
sudo apt install postfix
main.cfを変更
sudo vi /etc/postfix/main.cf
myhostname = ☆☆☆.xxx.com
mydomain = xxx.com
inet_interfaces = all
relayhost = [xxx.com]:1025
#----- 以下 最後尾に記載 --------
# メールの最大サイズを変更
message_size_limit = 40960000
# 全てのメールに対して、1通送る事に○秒のsleep
smtp_destination_rate_delay = 5s
mydomain = xxx.com
inet_interfaces = all
relayhost = [xxx.com]:1025
#----- 以下 最後尾に記載 --------
# メールの最大サイズを変更
message_size_limit = 40960000
# 全てのメールに対して、1通送る事に○秒のsleep
smtp_destination_rate_delay = 5s
sudo systemctl start postfix.service
sudo systemctl enable postfix.service
sudo systemctl enable postfix.service
4.メールサーバからメールを自動受信するためgetmailをインストール
①getmailをダウンロード・インストール
sudo apt install getmail6
mkdir -m 0700 .getmail
sudo vi .getmail/getmailrc
mkdir -m 0700 .getmail
sudo vi .getmail/getmailrc
②getmailの設定
[options]
# verbose = 0 # 詳細表示なし
# delete = true # POPしたメールはサーバから削除する
# message_log = ~/.getmail/log # ログを保存する場合は以下2行をコメントアウト
# message_log_verbose = true
# サーバーから全てのメールを取得するのを止める
read_all = false
# 一度に取得するメール数を制限(環境により、数を調整)
max_messages_per_session = 10
[retriever]
# POP3で受信する場合(有効)
#type = SimplePOP3Retriever
# POP3 over SSLで受信する場合
type = SimplePOP3SSLRetriever
# メールサーバ
server = xxxx.ne.jp #取得するメールサーバを指定
# ユーザ名
username = xxx@xxxx.ne.jp #ユーザー名を指定
# パスワード
password = xxxxxxxxx #パスワードを指定
[destination]
type = MDA_external #MDAと連携する
path = /usr/sbin/sendmail
# 配送先のアドレスを設定 arguments = ("-f", "%(sender)", "-i", "-bm", "◇◇◇@xxxx.com")
# verbose = 0 # 詳細表示なし
# delete = true # POPしたメールはサーバから削除する
# message_log = ~/.getmail/log # ログを保存する場合は以下2行をコメントアウト
# message_log_verbose = true
# サーバーから全てのメールを取得するのを止める
read_all = false
# 一度に取得するメール数を制限(環境により、数を調整)
max_messages_per_session = 10
[retriever]
# POP3で受信する場合(有効)
#type = SimplePOP3Retriever
# POP3 over SSLで受信する場合
type = SimplePOP3SSLRetriever
# メールサーバ
server = xxxx.ne.jp #取得するメールサーバを指定
# ユーザ名
username = xxx@xxxx.ne.jp #ユーザー名を指定
# パスワード
password = xxxxxxxxx #パスワードを指定
[destination]
type = MDA_external #MDAと連携する
path = /usr/sbin/sendmail
# 配送先のアドレスを設定 arguments = ("-f", "%(sender)", "-i", "-bm", "◇◇◇@xxxx.com")
◇◇◇はalfrescoに設定したEメールエイリアスを記載
getmailはデーモンで動作しないため、crontabで定期実行 ex.5分毎
cron設定は、全ての設定が完了後実行します。
crontab -e
# 標準エラーの出力を無効可しないと配送エラーとなるため /dev/null 2>&1を追加
*/5 * * * * /usr/bin/getmail > /dev/null 2>&1
*/5 * * * * /usr/bin/getmail > /dev/null 2>&1
0 件のコメント:
コメントを投稿