upgrade zend (#1559)
[openemr.git] / vendor / zendframework / zend-mail / doc / book / transport / smtp-options.md
blobc66d4934a2992f801d7cc7980a10b283b5cdd927
1 # SMTP Transport Options
3 This document details the various options available to the
4 `Zend\Mail\Transport\Smtp` mail transport.
6 ## Quick Start
8 ### Basic SMTP Transport Usage
10 ```php
11 use Zend\Mail\Transport\Smtp as SmtpTransport;
12 use Zend\Mail\Transport\SmtpOptions;
14 // Setup SMTP transport
15 $transport = new SmtpTransport();
16 $options   = new SmtpOptions([
17     'name' => 'localhost.localdomain',
18     'host' => '127.0.0.1',
19     'port' => 25,
20 ]);
21 $transport->setOptions($options);
22 ```
24 If you require authentication, see the section on [SMTP authentication](smtp-authentication.md#examples)
25 for examples of configuring authentication credentials.
27 ## Configuration Options
29 Option name         | Description
30 ------------------- | -----------
31 `name`              | Name of the SMTP host; defaults to "localhost".
32 `host`              | Remote hostname or IP address; defaults to "127.0.0.1".
33 `port`              | Port on which the remote host is listening; defaults to "25".
34 `connection_class`  | Fully-qualified classname or short name resolvable via `Zend\Mail\Protocol\SmtpPluginManager`. See the [SMTP authentication](smtp-authentication.md#connection_class) documentation for details.
35 `connection_config` | Optional associative array of parameters to pass to the connection class in order to configure it. By default, this is empty. See the [SMTP authentication](smtp-authentication.md#connection_config) documentation for details.
37 ## Available Methods
39 ### getName
41 ```php
42 getName() : string
43 ```
45 Returns the string name of the local client hostname.
47 ### setName
49 ```php
50 setName(string $name) : void
51 ```
53 Set the string name of the local client hostname.
55 ### getConnectionClass
57 ```php
58 getConnectionClass() : string
59 ```
61 Returns a string indicating the connection class name to use.
63 ### setConnectionClass
65 ```php
66 setConnectionClass(string $connectionClass) : void
67 ```
69 Set the connection class to use.
71 ### getConnectionConfig
73 ```php
74 getConnectionConfig() : array
75 ```
77 Get configuration for the connection class.
79 ### setConnectionConfig
81 ```php
82 setConnectionConfig(array $config) : void
83 ```
85 Set configuration for the connection class. Typically, if using anything other
86 than the default connection class, this will be an associative array with the
87 keys "username" and "password".
89 ### getHost
91 ```php
92 getHost() : string
93 ```
95 Returns a string indicating the IP address or host name of the SMTP server via
96 which to send messages.
98 ### setHost
100 ```php
101 setHost(string $host) : void
104 Set the SMTP host name or IP address.
106 ### getPort
108 ```php
109 getPort() : int
112 Retrieve the integer port on which the SMTP host is listening.
114 ### setPort
116 ```php
117 setPort(int $port) : void
120 Set the port on which the SMTP host is listening.
122 ### \_\_construct
124 ```php
125 __construct(null|array|Traversable $config) : void
128 Instantiate the class, and optionally configure it with values provided.