1

メールを送信する必要がある webapp を開発しています。次のインターフェイス クラスで基本的なメール ルーター (間違っていなければ sendmail です) を使用しています。

class My_Mail_Interface
{
    protected $_defaultCharset = 'utf-8';

    public function __construct() {
        $this->init();
    }

    public function init() {

    }

    /**
     * Send the email
     * @param string $from the sender address
     * @param string $to the receiver address
     * @param string $subject the subject
     * @param string $bodyHtml the HTML message
     * @param string $bodyText the text message
     * @param string $sender the sender label
     * @param string $receiver the receiver label
     * @return void
     */
    public function send($from, $to, $subject, $bodyHtml = NULL, $bodyText = NULL, $sender = NULL, $receiver = NULL) {
        if (!isset($sender)) {
            $sender = $from;
        }
        if (!isset($receiver)) {
            $receiver = $to;
        }
        $mail = $this->_getNewMail();
        $mail->setFrom($from, $sender);
        $mail->addTo($to, $receiver);
        $mail->setSubject($subject);
        $mail->setBodyHtml($bodyHtml);
        $mail->setBodyText($bodyText);
        $mail->send();
    }

    /**
     * Get a new mail object
     * @return Zend_Mail
     */
    protected function _getNewMail() {
        return new Zend_Mail($this->_defaultCharset);
    }

}

Yahoo アドレスにメールを送信する場合は問題なく動作しますが、GMail アドレスにメールを送信する場合は失敗します。将来的には SendGrid などのメール サービスに移行する予定ですが、テスト目的であれば、この構成を使用しても問題ありません。私が見逃している点はありますか、それとも GMail がスパム妄想症になったのでしょうか?

4

0 に答える 0