携帯向けメール配信の最大の難関、それはキャリアブロック(受信ブロック)です。
元々はSPAM対策としてキャリア側で導入された機能ですが、通すチェックが厳しく通常に運用しているサイトでも普通に影響を受けます。
大体1000通のメールを送った場合でも550(宛先)エラー率5%でキャリアブロックを受けると言われ、10%を越えるとものの数分でブロックされます。
そこで携帯向けメール配信ではメールクリーニングと呼ばれる550(宛先)エラーのメール処理が非常に重要となってくるのですが今回はその処理を紹介します。
まず宛先エラーのメールを送信してみてキャリアからどのようなエラーメールが返ってくるかを検証します。
mb_send_mail( 'hogehoge_selva@docomo.ne.jp', 'subject', 'TextTextText', 'from:from@hogehoge.com', '-f error@hogehoge.com' );
第5引数にエラーメールが返信されるアドレスを指定出来ます。
上の例ではerror@hogehoge.com でエラーメールを受信出来ます。
実際の各キャリアの550(宛先)エラーメールの内容です。
docomo
Return-Path: <> Delivered-To: error@hogehoge.com Received: (qmail 22872 invoked for bounce); 9 Apr 2008 23:37:08 +0900 Date: 9 Apr 2008 23:37:08 +0900 From: MAILER-DAEMON@hogehoge.com To: error@hogehoge.com Subject: failure notice Hi. This is the qmail-send program at hogehoge.com. I'm afraid I wasn't able to deliver your message to the following address es. This is a permanent error; I've given up. Sorry it didn't work out.: 210.153.85.241 does not like recipient. Remote host said: 550 Unknown user selva_test@docomo.ne.jp Giving up on 203.138.181.112. --- Below this line is a copy of the message. Return-Path: Received: (qmail 22869 invoked by uid 506); 9 Apr 2008 23:37:08 +0900 Date: 9 Apr 2008 23:37:08 +0900 Message-ID: <200804091XXXXXX.XXXXX.qmail@hogehoge.com> To: selva_test@docomo.ne.jp Subject: -test- from: from@hogehoge.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit TextTextText
AU
Return-Path: <> Delivered-To: error@hogehoge.com Received: (qmail 5240 invoked for bounce); 26 Sep 2008 21:41:53 +0900 Date: 26 Sep 2008 21:41:53 +0900 From: MAILER-DAEMON@hogehoge.com To: error@hogehoge.com Subject: failure notice Hi. This is the qmail-send program at hogehoge.com. I'm afraid I wasn't able to deliver your message to the following addresses. This is a permanent error; I've given up. Sorry it didn't work out.: 222.15.69.195 does not like recipient. Remote host said: 550 : User unknown Giving up on 222.15.69.195. --- Below this line is a copy of the message. Return-Path: Received: (qmail 5238 invoked by uid 513); 26 Sep 2008 21:41:53 +0900 Date: 26 Sep 2008 21:41:53 +0900 Message-ID: <2008092XXXXXX.XXXX.qmail@hogehoge.com> To: hogehoge_selva@ezweb.ne.jp Subject: subject from: from@hogehoge.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: BASE64 TextTextText
SoftBank
Return-Path: <> Delivered-To: error@hogehoge.com Received: (qmail XXXX invoked for bounce); 26 Sep 2008 21:41:41 +0900 Date: 26 Sep 2008 21:41:41 +0900 From: MAILER-DAEMON@hogehoge.com To: error@hogehoge.com Subject: failure notice Hi. This is the qmail-send program at hogehoge.com. I'm afraid I wasn't able to deliver your message to the following addresses. This is a permanent error; I've given up. Sorry it didn't work out.: 133.217.192.21 does not like recipient. Remote host said: 550 5.1.1 : Recipient address rejected: User unknown in local recipient table Giving up on 133.217.192.21. --- Below this line is a copy of the message. Return-Path: Received: (qmail 5229 invoked by uid 513); 26 Sep 2008 21:41:41 +0900 Date: 26 Sep 2008 21:41:41 +0900 Message-ID: <20080926XXXXXX.XXXX.qmail@hogehoge.com> To: hogehoge_selva@softbank.co.jp Subject: subject nakayama from: from@hogehoge.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: BASE64 TextTextText
後編ではこのエラーメールを元にエラー処理を行ないます。