2006年9月アーカイブ

Postfix Dovecot imap4 Maildir形式

|

参考サイト

http://fedorasrv.com/postfix.shtml

http://www.aconus.com/~oyaji/centos/smtp-centos.htm

■Postfixインストール

[root@fedora ~]# yum -y install postfix ← Postfixインストール

 

■Postfix設定

(1)Postfix設定
[root@fedora ~]# vi /etc/postfix/main.cf ← Postfix設定ファイル編集
# INTERNET HOST AND DOMAIN NAMES
#
# The myhostname parameter specifies the internet hostname of this
# mail system. The default is to use the fully-qualified domain name
# from gethostname(). $myhostname is used as a default value for many
# other configuration parameters.
#
#myhostname = host.domain.tld
#myhostname = virtual.domain.tld
myhostname = fedora.fedorasrv.com ← 追加(自FQDN名を指定)

# The mydomain parameter specifies the local internet domain name.
# The default is to use $myhostname minus the first component.
# $mydomain is used as a default value for many other configuration
# parameters.
#
#mydomain = domain.tld
mydomain = fedorasrv.com ← 追加(自ドメイン名を指定)

# SENDING MAIL
#
# The myorigin parameter specifies the domain that locally-posted
# mail appears to come from. The default is to append $myhostname,
# which is fine for small sites.  If you run a domain with multiple
# machines, you should (1) change this to $mydomain and (2) set up
# a domain-wide alias database that aliases each user to
# user@that.users.mailhost.
#
# For the sake of consistency between sender and recipient addresses,
# myorigin also specifies the default domain name that is appended
# to recipient addresses that have no @domain part.
#
#myorigin = $myhostname
#myorigin = $mydomain
myorigin = $mydomain ← 追加(ローカルからのメール送信時の送信元メールアドレス@以降にドメイン名を付加)

# The inet_interfaces parameter specifies the network interface
# addresses that this mail system receives mail on.  By default,
# the software claims all active interfaces on the machine. The
# parameter also controls delivery of mail to user@[ip.address].
#
# See also the proxy_interfaces parameter, for network addresses that
# are forwarded to us via a proxy or network address translator.
#
# Note: you need to stop/start Postfix when this parameter changes.
#
#inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
inet_interfaces = localhost

inet_interfaces = all ← 変更(外部からのメール受信を許可)

# The mydestination parameter specifies the list of domains that this
# machine considers itself the final destination for.
#
# These domains are routed to the delivery agent specified with the
# local_transport parameter setting. By default, that is the UNIX
# compatible delivery agent that lookups all recipients in /etc/passwd
# and /etc/aliases or their equivalent.
#
# The default is $myhostname + localhost.$mydomain.  On a mail domain
# gateway, you should also include $mydomain.
#
# Do not specify the names of virtual domains - those domains are
# specified elsewhere (see VIRTUAL_README).
#
# Do not specify the names of domains that this machine is backup MX
# host for. Specify those names via the relay_domains settings for
# the SMTP server, or use permit_mx_backup if you are lazy (see
# STANDARD_CONFIGURATION_README).
#
# The local machine is always the final destination for mail addressed
# to user@[the.net.work.address] of an interface that the mail system
# receives mail on (see the inet_interfaces parameter).
#
# Specify a list of host or domain names, /file/name or type:table
# patterns, separated by commas and/or whitespace. A /file/name
# pattern is replaced by its contents; a type:table is matched when
# a name matches a lookup key (the right-hand side is ignored).
# Continue long lines by starting the next line with whitespace.
#
# See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS".
#
mydestination = $myhostname, localhost.$mydomain, localhost

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain ← 変更(自ドメイン宛メールを受信できるようにする)
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
#       mail.$mydomain, www.$mydomain, ftp.$mydomain

# DELIVERY TO MAILBOX
#
# The home_mailbox parameter specifies the optional pathname of a
# mailbox file relative to a user's home directory. The default
# mailbox file is /var/spool/mail/user or /var/mail/user.  Specify
# "Maildir/" for qmail-style delivery (the / is required).
#
#home_mailbox = Mailbox
#home_mailbox = Maildir/
home_mailbox = Maildir/ ← 追加(メールボックス形式をMaildir形式にする)

# SHOW SOFTWARE VERSION OR NOT
#
# The smtpd_banner parameter specifies the text that follows the 220
# code in the SMTP server's greeting banner. Some people like to see
# the mail version advertised. By default, Postfix shows no version.
#
# You MUST specify $myhostname at the start of the text. That is an
# RFC requirement. Postfix itself does not care.
#
#smtpd_banner = $myhostname ESMTP $mail_name
#smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
smtpd_banner = $myhostname ESMTP unknown ← 追加(メールサーバーソフト名の隠蔽化)

以下を最終行へ追加(SMTP-Auth設定)
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

以下を最終行へ追加(メール不正中継ホストのデータベースに登録されているホストからの接続を拒否する場合)
smtpd_client_restrictions = reject_rbl_client relays.ordb.org

以下を最終行へ追加(SMTP-Auth設定)
message_size_limit = 10485760 ← 追加(受信メールサイズを10MB=10*1024*1024に制限)

 


(2)SMTP-Auth設定
SMTP-Auth用ユーザ名、パスワードにシステムのユーザ名、パスワードを使用する場合)
 
[root@fedora ~]# /etc/rc.d/init.d/saslauthd start ← saslauthd起動
saslauthd を起動中:                                        [  OK  ]

[root@fedora ~]# chkconfig saslauthd on ← saslauthd自動起動設定

[root@fedora ~]# chkconfig --list saslauthd ← saslauthd自動起動設定確認
saslauthd       0:off   1:off   2:on    3:on    4:on    5:on    6:off ← ランレベル2~5のonを確認

SMTP-Auth用ユーザ名、パスワードとシステムのユーザ名、パスワードを別々にする場合
 
[root@fedora ~]# vi /usr/lib/sasl2/smtpd.conf ← SMTP-Auth認証設定ファイル編集
pwcheck_method: saslauthd
↓
pwcheck_method: auxprop ← 変更

(3)Maildir形式メールボックス作成
Postfixのメール格納形式は共有ディレクトリ形式(「/var/spool/mail/ユーザ名」というファイルに全てのメールが蓄積されていく形式)だが、アクセス性能改善及びセキュリティ強化の観点からMaildir形式へ移行する。

【既存ユーザ対処】
既存ユーザのホームディレクトリにMaildir形式のメールボックスを作成して、蓄積済のメールデータを当該メールボックスへ移行する⇒メールデータ移行を参照

【新規ユーザ対処】
新規ユーザ追加時に自動でホームディレクトリにMaildir形式のメールボックスが作成されるようにする
 

 

[root@fedora ~]# mkdir -p /etc/skel/Maildir/new ← 新規ユーザ追加時に自動でMaildir形式メールボックス作成(1/4)

[root@fedora ~]# mkdir -p /etc/skel/Maildir/cur ← 新規ユーザ追加時に自動でMaildir形式メールボックス作成(2/4)

[root@fedora ~]# mkdir -p /etc/skel/Maildir/tmp ← 新規ユーザ追加時に自動でMaildir形式メールボックス作成(3/4)

[root@fedora ~]# chmod -R 700 /etc/skel/Maildir/ ← 新規ユーザ追加時に自動でMaildir形式メールボックス作成(4/4)

 


(4)未承諾広告メールの削除
未承諾広告メール(件名に「未承諾広告※」と表示されているメール)は受信せずに削除するようにする。
[root@fedora ~]# vi /etc/postfix/main.cf ← Postfix設定ファイル編集
# The mailbox_command parameter specifies the optional external
# command to use instead of mailbox delivery. The command is run as
# the recipient with proper HOME, SHELL and LOGNAME environment settings.
# Exception:  delivery for root is done as $default_user.
#
# Other environment variables of interest: USER (recipient username),
# EXTENSION (address extension), DOMAIN (domain part of address),
# and LOCAL (the address localpart).
#
# Unlike other Postfix configuration parameters, the mailbox_command
# parameter is not subjected to $parameter substitutions. This is to
# make it easier to specify shell syntax (see example below).
#
# Avoid shell meta characters because they will force Postfix to run
# an expensive shell process. Procmail alone is expensive enough.
#
# IF YOU USE THIS TO DELIVER MAIL SYSTEM-WIDE, YOU MUST SET UP AN
# ALIAS THAT FORWARDS MAIL FOR ROOT TO A REAL USER.
#
#mailbox_command = /some/where/procmail
#mailbox_command = /some/where/procmail -a "$EXTENSION"
mailbox_command = /usr/bin/procmail ← 追加(Procmailと連携するようにする)

[root@fedora ~]# vi /etc/procmailrc ← procmail設定ファイル作成
SHELL=/bin/bash
PATH=/usr/bin:/bin
DROPPRIVS=yes
MAILDIR=$HOME/Maildir
DEFAULT=$MAILDIR/
#LOGFILE=$HOME/procmail.log # ログ出力先
#VERBOSE=ON # 詳細ログ出力

# 未承諾広告メール削除※システムの文字コードがUTF-8(デフォルト)の場合
:0
* ^Subject:.*iso-2022-jp
* ^Subject:\/.*
* ? echo "$MATCH" | nkf -mwZ2 | sed 's/[[:space:]]//g' | egrep '未承諾広告※'
/dev/null

# 未承諾広告メール削除※システムの文字コードがEUCの場合
:0
* ^Subject:.*iso-2022-jp
* ^Subject:\/.*
* ? echo "$MATCH" | nkf -meZ2 | sed 's/[[:space:]]//g' | egrep '未承諾広告※'
/dev/null

 

■Postfix起動

(1)sendmail停止
デフォルトで起動しているSMTPサーバーであるsendmailを停止する
[root@fedora ~]# /etc/rc.d/init.d/sendmail stop ← sendmail停止
sendmailを停止中:                                          [  OK  ]
sm-clientを停止中:                                         [  OK  ]

[root@fedora ~]# chkconfig sendmail off ← sendmail自動起動設定解除

[root@fedora ~]# chkconfig --list sendmail ← sendmail自動起動設定解除確認
sendmail        0:off   1:off   2:off   3:off   4:off   5:off   6:off ← 全ランレベルのoffを確認

(2)メールサーバー切替え
システムで使用するメールサーバー機能をsendmailからPostfixに切替える
[root@fedora ~]# alternatives --config mta ← メールサーバー切替え

2 プログラムがあり 'mta'を提供します。

  選択       コマンド
-----------------------------------------------
*+ 1           /usr/sbin/sendmail.sendmail
   2           /usr/sbin/sendmail.postfix

Enterを押して現在の選択[+]を保持するか、選択番号を入力します:2 ← 2を応答

(3)Postfix起動
[root@fedora ~]# /etc/rc.d/init.d/postfix start ← Postfix起動
postfix を起動中:                                          [  OK  ]

[root@fedora ~]# chkconfig postfix on ← Postfix自動起動設定

[root@fedora ~]# chkconfig --list postfix ← Postfix自動起動設定確認
postfix         0:off   1:off   2:on    3:on    4:on    5:on    6:off ← ランレベル2~5のonを確認

(4)ポート25番のOPEN
ルーター側の設定でポート25番をOPENする。

ポートチェック【外部からポート開放確認】で「host名」にサーバー名(例:fedorasrv.com)、「port番号」に25と入力して「ポートチェック」ボタン押下し、「ホスト=fedorasrv.com ポート=25 にアクセスできました。」と表示されることを確認。

 

■Dovecot設定

[root@fedora ~]# vi /etc/dovecot.conf ← Dovecot設定ファイル編集
# Protocols we want to be serving:
#  imap imaps pop3 pop3s
#protocols = imap imaps pop3 pop3s
protocols = imap imaps pop3 pop3s ← 追加

# Default MAIL environment to use when it's not set. By leaving this empty
# dovecot tries to do some automatic detection as described in
# doc/mail-storages.txt. There's a few special variables you can use:
#
#   %u - username
#   %n - user part in user@domain, same as %u if there's no domain
#   %d - domain part in user@domain, empty if user there's no domain
#   %h - home directory
#
# You can also limit a width of string by giving the number of max. characters
# after the '%' character. For example %1u gives the first character of
# username. Some examples:
#
#   default_mail_env = maildir:/var/mail/%1u/%u/Maildir
#   default_mail_env = mbox:~/mail/:INBOX=/var/mail/%u
#   default_mail_env = mbox:/var/mail/%d/%n/:INDEX=/var/indexes/%d/%n
#
#default_mail_env =
default_mail_env = maildir:~/Maildir ← 追加(メールボックス形式をMaildir形式とする)


# ':' separated list of directories under which chrooting is allowed for mail
# processes (ie. /var/mail will allow chrooting to /var/mail/foo/bar too).
# This setting doesn't affect login_chroot or auth_chroot variables.
# WARNING: Never add directories here which local users can modify, that
# may lead to root exploit. Usually this should be done only if you don't
# allow shell access for users. See doc/configuration.txt for more information.
#valid_chroot_dirs =
valid_chroot_dirs = /home ← 追加※OpenSSH+Chrootを導入している場合のみ

 

■Dovecot起動

(1)Dovecot起動
[root@fedora ~]# /etc/rc.d/init.d/dovecot start ← Dovecot起動
Dovecot Imapを起動中:                                      [  OK  ]

[root@fedora ~]# chkconfig dovecot on ← Dovecot自動起動設定

[root@fedora ~]# chkconfig --list dovecot ← Dovecot自動起動設定確認
dovecot         0:off   1:off   2:on    3:on    4:on    5:on    6:off ← ランレベル2~5のonを確認

(2)ポート110番(POPの場合)または143番(IMAPの場合)のOPEN
ルーター側の設定でポート110番(POPの場合)または143番(IMAPの場合)をOPENする。

ポートチェック【外部からポート開放確認】で「host名」にサーバー名(例:fedorasrv.com)、「port番号」に110(POPの場合)または143(IMAPの場合)と入力して「ポートチェック」ボタン押下し、「ホスト=fedorasrv.com ポート=110(POPの場合)または143(IMAPの場合) にアクセスできました。」と表示されることを確認。

 

■メールユーザ追加

(1)メールユーザ追加(SSHによるリモート接続はできないようにする場合)
※例としてユーザ名をfedoraとする

 

[root@fedora ~]# useradd -s /sbin/nologin fedora ← ユーザ追加

[root@fedora ~]# passwd fedora ← パスワード設定
Changing password for user fedora.
New UNIX password:  ← パスワード応答
Retype new UNIX password:  ← パスワード応答(確認)
passwd: all authentication tokens updated successfully.

以下はSMTP-Auth用ユーザ名、パスワードとシステムのユーザ名、パスワードを別々にする場合のみ
[root@fedora ~]# echo "パスワード" | saslpasswd2 -p -u fedora.fedorasrv.com -c fedora ← SMTP-Auth用ユーザ/パスワード登録

[root@fedora ~]# sasldblistusers2 ← SMTP-Auth用ユーザ名、パスワード確認
fedora@fedora.fedorasrv.com: userPassword

[root@fedora ~]# chgrp postfix /etc/sasldb2 ← sasldb2所有グループをpostfixに変更※最初の1回のみ

※SMTP-Auth用ユーザ名、パスワードを削除する場合
[root@fedora ~]# saslpasswd2 -d fedora -u fedora.fedorasrv.com ← SMTP-Auth用ユーザ名、パスワード削除

 


(2)メールユーザ追加(SSHによるリモート接続もできるようにする場合)
※例としてユーザ名をfedoraとする

 

[root@fedora ~]# useradd fedora ← ユーザ追加

[root@fedora ~]# passwd fedora ← パスワード設定
Changing password for user fedora.
New UNIX password:  ← パスワード応答
Retype new UNIX password:  ← パスワード応答(確認)
passwd: all authentication tokens updated successfully.

以下はSMTP-Auth用ユーザ名、パスワードとシステムのユーザ名、パスワードを別々にする場合のみ
[root@fedora ~]# echo "パスワード" | saslpasswd2 -p -u fedora.fedorasrv.com -c fedora ← SMTP-Auth用ユーザ/パスワード登録

[root@fedora ~]# sasldblistusers2 ← SMTP-Auth用ユーザ名、パスワード確認
fedora@fedora.fedorasrv.com: userPassword

[root@fedora ~]# chgrp postfix /etc/sasldb2 ← sasldb2所有グループをpostfixに変更※最初の1回のみ

※SMTP-Auth用ユーザ名、パスワードを削除する場合
[root@fedora ~]# saslpasswd2 -d fedora -u fedora.fedorasrv.com ← SMTP-Auth用ユーザ名、パスワード削除

 


(3)既存ユーザをメールユーザとする場合
※例としてユーザ名をfedoraとする

 

以下はSMTP-Auth用ユーザ名、パスワードとシステムのユーザ名、パスワードを別々にする場合のみ
[root@fedora ~]# echo "パスワード" | saslpasswd2 -p -u fedora.fedorasrv.com -c fedora ← SMTP-Auth用ユーザ/パスワード登録

[root@fedora ~]# sasldblistusers2 ← SMTP-Auth用ユーザ名、パスワード確認
fedora@fedora.fedorasrv.com: userPassword

[root@fedora ~]# chgrp postfix /etc/sasldb2 ← sasldb2所有グループをpostfixに変更※最初の1回のみ

※SMTP-Auth用ユーザ名、パスワードを削除する場合
[root@fedora ~]# saslpasswd2 -d fedora -u fedora.fedorasrv.com ← SMTP-Auth用ユーザ名、パスワード削除

 

■メール不正中継拒否テスト

[root@fedora ~]# telnet relay-test.mail-abuse.org ← メール不正中継拒否テスト
・
・
・
:Relay test: #test 19
>>> mail from: 
<<< 250 Ok
>>> rcpt to: 
<<< 554 : Relay access denied
>>> rset
<<< 421 fedora.fedorasrv.com Error: too many errors
Connecting to xxx.xxx.xxx.xxx ...
<<< 220 fedora.fedorasrv.com ESMTP unknown
>>> HELO cygnus.mail-abuse.org
<<< 250 fedora.fedorasrv.com
>>> QUIT
<<< 221 Bye
Tested host banner: 220 fedora.fedorasrv.com ESMTP unknown
System appeared to reject relay attempts ← 19種類のテストの正常(不正中継拒否)を確認
Connection closed by foreign host.

 

 

# yum install postfix

# vi /etc/postfix/main.cf

Postfixの設定は、/etc/postfix/main.cf を編集します。SMTPを動かすための基本的な設定を下記により行います。ここでは、修正した部分のみ記載しています。(青字は削除、赤字は追加、緑字は変更したものです。)
 
# ホスト名の設定
# myhostnameでは、通常サーバのホスト名を指定する。しかし、ここで設定するホスト名は
# myoriginの設定と関係しており、myoriginをmyhostnameとした場合は、このホスト名は
# インターネット上でDNSで名前解決できるホスト名でなければならない。
# zive.orgのように、MXを使うとホスト名が使えない場合は、サブドメインをそのまま指定すればよい。
#myhostname = host.domain.tld
#myhostname = virtual.domain.tld
myhostname = mail.aconus.com

# ドメイン名の設定
#mydomain = domain.tld
mydomain = aconus.com

# メール送信の設定
# ローカルで配送されたメールがどこからくるように見えるか指定するもので、デフォルトの
# $myhostnameを指定すればいい。分かりにくい表現であるが、ここの値は、localhostが
# 送信する場合のホスト名として@以下に設定されるもので、例えば、デーモンが吐くメール
# やCGIでメールを送信したり、procmailで転送する場合の送信元に設定される。従って、
# ここで指定されたホスト名は、インターネット上でDNSが牽ける名前でないと、相手サーバで
# エラー発生時に返信するためチェックされており、その時点で蹴られてしまうので、注意が
# 必要である。
# ここでの設定は後述するsaslpasswd2の設定時のmydomainと同一でないとエラーとなるので
# 注意が必要。
#myorigin = $myhostname
#myorigin = $mydomain
myorigin = $myhostname

# メール受信の設定
# メールを受け取るネットワークインタフェースのアドレス範囲を指定する。特別な用件が無ければ指定不要(default=all)。
#inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
#inet_interfaces = localhost
inet_interfaces = all

# メールの最終目的地とみなす範囲の指定
#mydestination = $myhostname, localhost.$mydomain, localhost
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
#          mail.$mydomain, www.$mydomain, ftp.$mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

# 信頼できるクライアントのネットワークを指定(192.168.0.0/24と192.168.1.0/24を合わせて指定)
#mynetworks = 168.100.189.0/28, 127.0.0.0/8
#mynetworks = $config_directory/mynetworks
#mynetworks = hash:/etc/postfix/network_table
mynetworks =  192.168.0.0/23, 127.0.0.0/8

# リレーを許可するドメインを指定
#relay_domains = $mydestination
relay_domains = $mydestination

# メールBOXの形式を指定
# Courier-imapを使うため、Maildir形式とする。
#home_mailbox = Mailbox
#home_mailbox = Maildir/
home_mailbox = Maildir/

# sendmail互換プログラムの修正
# sendmail互換プログラムがsendmail.postfixとなっており、CGIとの整合が取れないので修正する。
# CGI側を修正する場合は、下記を含めて修正は不要です。
#sendmail_path = /usr/sbin/sendmail.postfix
sendmail_path = /usr/sbin/sendmail
 

 

◆sendmail互換プログラムの修正

messagesにsendmailのpathがおかしいと出ていたので調査したところ、/usr/sbin/sendmailが互換プログラムに置き換わっておらず、CGIからのメール利用ができなくなっていました。下記で修正が必要です。
 
# mv /usr/sbin/sendmail /usr/sbin/sendmail.bak
# ln -s /usr/sbin/sendmail.postfix /usr/sbin/sendmail

◆aliasesの修正

RPMからインストールするとroot宛てのメッセージがpostfix宛てに配送されるようになっています。postfixユーザを追加するか、メールを受け取れる実在するユーザに配送先を変更する必要があります。ここでは、おやじ宛てに配送する変更例を示します。
 
# vi /etc/aliases
postfix:   root  # この行を追加

[Esc]、[:]、[w]、[q]で保存し、newaliasesを実行。

# newaliases

/includes/modules/checkout_process.php

// send additional emails
if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
$extra_info=email_collect_extra_info('','', $order->customer['lastname'] . ' ' . $order->customer['firstname'] , $order->customer['email_address']);
$html_msg['EXTRA_INFO'] = $extra_info['HTML'];
zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $insert_id,
$email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra');
}

を以下に変更


// send additional emails
if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
$extra_info=email_collect_extra_info('','', $order->customer['lastname'] . ' ' . $order->customer['firstname'] , $order->customer['email_address']);
$html_msg['EXTRA_INFO'] = $extra_info['HTML'];
// zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $insert_id,
// $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra');
zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $insert_id,
$email_order . $extra_info['TEXT'], $order->customer['lastname'] . ' ' . $order->customer['firstname'] , $order->customer['email_address'] , $html_msg, 'checkout_extra');
}

------------------
v1.3 では、

/includes/calssess/order.php の最終行近辺。

----------------------

// send additional emails
if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
$extra_info=email_collect_extra_info('','', $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $this->customer['telephone']);
$html_msg['EXTRA_INFO'] = $extra_info['HTML'];
// zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
// $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra');
zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
$email_order . $extra_info['TEXT'], $this->customer['firstname'] . ' ' . $this->customer['lastname'] , $this->customer['email_address'], $html_msg, 'checkout_extra');
}

---------------------

ZenCartカスタマイズ

|

ZenCartカスタマイズ
http://www.gnnk.net/archives/category/zencart/


Archive for the 'ZenCart' Category
« Previous Entries[ZenCart]新着商品の登録日の非表示
Thursday, September 7th, 2006
/include/modules/products_new_listing.php

PLAIN TEXTPHP:

if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_DATE_ADDED') {
echo $display_products_date_added;
}

をコメントアウト

[ZenCart]振込先の改行
Wednesday, June 7th, 2006
webでの表示と注文受付のメール、
どちらも改行するには、

PLAIN TEXTHTML:


\n
と、改行部分に入力する。

[ZenCart]注文メールSubjectの注文番号を削除
Wednesday, May 24th, 2006
/includes/modules/checkout_process.php

PLAIN TEXTPHP:

. EMAIL_ORDER_NUMBER_SUBJECT . $insert_id

を削除

[ZenCart]商品詳細のモデル削除
Tuesday, May 23rd, 2006
/includes/templates/テンプレート名
/templates/tpl_product_info_display.php

PLAIN TEXTPHP:


TEXT_PRODUCT_MODEL . $products_model : ' '); ?>

を削除

[ZenCart]デバッグ
Saturday, May 20th, 2006
includes\classes\template_function.phpの 45~61行目

PLAIN TEXTPHP:

function get_template_dir($template_code, $current_template,
$current_page, $template_dir, $debug=false) {
// echo 'template_default/' . $template_dir . '=' . $template_code;
if ($this->file_exists($current_template . $current_page, $template_code)) {
return $current_template . $current_page . '/';
} elseif ($this->file_exists(DIR_WS_TEMPLATES . 'template_default/' . $current_page, ereg_replace('/', '', $template_code), $debug)) {
return DIR_WS_TEMPLATES . 'template_default/' . $current_page;
} elseif ($this->file_exists($current_template . $template_dir, ereg_replace('/', '', $template_code), $debug)) {
return $current_template . $template_dir;
} else {
return DIR_WS_TEMPLATES . 'template_default/' . $template_dir;
// return $current_template . $template_dir;
}
}

PLAIN TEXTPHP:

function get_template_dir($template_code, $current_template, $current_page, $template_dir, $debug=false) {
// echo 'template_default/' . $template_dir . '=' . $template_code;
if ($this->file_exists($current_template . $current_page, $template_code)) {
echo $current_template . $current_page . '=' . $template_code . '/' . '
';
return $current_template . $current_page . '/';
} elseif ($this->file_exists(DIR_WS_TEMPLATES . 'template_default/' . $current_page, ereg_replace('/', '', $template_code), $debug)) {
echo DIR_WS_TEMPLATES . 'template_default/' . $current_page .'=' . $template_code.'
';
return DIR_WS_TEMPLATES . 'template_default/' . $current_page;
} elseif ($this->file_exists($current_template . $template_dir, ereg_replace('/', '', $template_code), $debug)) {
echo $current_template . $template_dir. '=' . $template_code.'
';
return $current_template . $template_dir;
} else {
echo DIR_WS_TEMPLATES . 'template_default/' . $template_dir. '=' . $template_code.'
';
return DIR_WS_TEMPLATES . 'template_default/' . $template_dir;
// return $current_template . $template_dir;
}
}

[ZenCart]画像の縦横比
Wednesday, May 17th, 2006
管理画面の「一般設定」→画像の「設定」
縦横どちらかのサイズを0に指定
「画像サイズを計算する」をTrueに設定
縦横比を保持したまま計算して拡大縮小

[ZenCart]地域別送料設定
Wednesday, May 17th, 2006
地域・税率設定 -> 地域税に進む
「北海道・沖縄」という地域を追加
その地域で「詳細」ボタンを押す
その地域に北海道と沖縄を紐付けする
「定額料金」の配送モジュールを元にして、「定額料金(北海道・沖縄)」という配送モジュールを新しく作る
「定額料金(北海道・沖縄)」モジュールをインストールして、「配送地域」として「北海道・沖縄」を紐付け。

モジュールの追加
includes/modules/shipping/flat.php を includes/modules/shipping/flatritou.phpなどにコピー
includes/languages/japanese/modules/shipping/flat.phpを
includes/languages/japanese/modules/shipping/flatritou.phpなどにコピー
falt -> flatritou
FLAT -> FLATRITOU
のように置換

[ZenCart]文章の修正
Wednesday, May 17th, 2006
タイトルの修正
/includes/languages/テンプレート名/japanese.php
各文章の修正
/includes/languages/japanese/テンプレート名/***.php

[ZenCart]テンプレートの追加
Wednesday, May 17th, 2006
[includes/templates/]を開き、ディレクトリを追加
includes/templates/テンプレート名/template_info.php
$template_name = ‘テンプレート名’;
管理画面から、各種ツール>テンプレート設定>編集ボタンをクリック
ドロップダウンメニューより、作成したテンプレートを選択し更新ボタンをクリック
各種ツール>サイドボックスのレイアウト設定を選び、画面最下部のリセットボタンをクリック

[ZenCart]Google Analyticsの設置
Wednesday, May 17th, 2006
includes/templates/テンプレート名/common/tpl_main_page.php

[ZenCart]国名非表示・都道府県ドロップダウン化
Wednesday, May 17th, 2006
YOUR_TEMPLATEフォルダを実際のテンプレートフォルダ名に変更
zen_address_format.sql内のテーブル名を変更
zen_address_format.sqlをphpMyAdminなどで実行
フォルダ/ファイルをコピーする。
管理画面→地域・税率設定→国名設定→Japan
の住所フォーマットを7に変更して更新

[ZenCart]在庫数の非表示
Wednesday, May 17th, 2006
「商品の管理」>「商品タイプの管理」
>「Product - General」>「edit layout」
>「Show Date Available」

このアーカイブについて

このページには、2006年9月に書かれたブログ記事が新しい順に公開されています。

前のアーカイブは2006年8月です。

次のアーカイブは2006年10月です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。