Diary

AWS EC2 Amazon Linux 2 AMI 2.0 Instance PHP.ini Initial Setup for Japanese Mail and WordPress

1 Mins read

Amazon Linux 2 AMI 2.0.20181008 x86_64 HVM gp2
Apache 2.4.39
PHP 7.3.6

If you only need to send mail, this configuration should be enough. Since we’re not considering relay or mail reception, you don’t need to open ports 25 or 587 in AWS Security Group [In].

If you aim to send or receive large volumes of email from within AWS VPC, you’ll need to go through AWS’s email sending limit removal request, which takes considerable effort. With current restrictions, you won’t hit limits at 200 emails per 24 hours or 1 per second, so this should be fine for administrative mail purposes.

Check mta

# Command to check installed mta
alternatives --display mta

mta - status is automatic.
Link currently points to /usr/sbin/sendmail.postfix.

sendmail.postfix should be installed, but if not, install it via yum or similar.

PHP.ini

; Change port to 587
smtp_port=587

; mta path & command settings
sendmail_path = /usr/sbin/sendmail.postfix -t -i

; Default character encoding
default_charset = UTF-8

; mbstring defaults
mbstring.language = Japanese
; Do not auto-convert HTTP input character encoding to internal character encoding

mbstring.encoding_translation = Off

; Character code detection priority order
mbstring.detect_order = UTF-8,SJIS,EUC-JP,JIS,ASCII

; Set timezone to Japan Standard Time
date.timezone = Asia/Tokyo

; Security improvement - hide PHP version info
expose_php = Off