1

I'm developing a webapp which has to send mail, I'm using the basic mail router (which is sendmail if I'm not wrong) with the following interface class :

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);
    }

}

It works fine when it's about sending email to a Yahoo address but it fails when sending email to a GMail one. I plan to move to mail services like SendGrid in the future, but for test purpose using this configuration shouldn't be a problem. Is there a point I'm missing or has GMail becomed SPAM paranoiac ?

AsTeR
  • 7,247
  • 14
  • 60
  • 99

0 Answers0