zendframework / zend-mail

Mail component from Zend Framework
BSD 3-Clause "New" or "Revised" License
96 stars 111 forks source link

Zend\Mail\Transport\Factory::create expects an array or Traversable argument; received "NULL" #95

Open adilogs opened 8 years ago

adilogs commented 8 years ago

I am using a Zend Mail component using Transport/Factory and SMTP configuration. I am constantly getting this error despite using proper guidelines in the Zend documentation .

Zend\Mail\Transport\Exception\InvalidArgumentException

File:
C:\xampp\htdocs\website\vendor\zendframework\zend-mail\src\Transport\Factory.php:42
Message:
Zend\Mail\Transport\Factory::create expects an array or Traversable argument; received "NULL"
froschdesign commented 8 years ago

@adilogs

despite using proper guidelines

Please provide your specification for the factory.

adilogs commented 8 years ago

@froschdesign I used the SMTP configuration as specified here: http://framework.zend.com/manual/current/en/modules/zend.mail.smtp.options.html#smtp-transport-usage-with-login-auth

my mailservice.global.php is like this

<?php
/**
 * MailService Configuration
 *
 * If you have a ./config/autoload/ directory set up for your project, you can
 * drop this config file in it and change the values as you wish.
 */
$settings = array(

    /**
     * Transport Class
     *
     * Name of Zend Transport Class to use
     */
    'transport_class' => 'Zend\Mail\Transport\Smtp',

    'options_class' => 'Zend\Mail\Transport\SmtpOptions',

    'transport_options' => array(
        'name'              => 'localhost',
        'host'              => '127.0.0.1',
        'connection_class' => 'login',
        'connection_config' => array(
            'ssl' => 'tls',
            'username' => 'YOUR-USERNAME-HERE@gmail.com',
            'password' => 'YOUR-PASSWORD-HERE'
        ),
        'port' => 587
    ),
    /**
     * End of MailService configuration
     */
);

/**
 * You do not need to edit below this line
 */
return array(
    'mailservice' => $settings,
);
michalbundyra commented 4 years ago

This repository has been closed and moved to laminas/laminas-mail; a new issue has been opened at https://github.com/laminas/laminas-mail/issues/60.