#include <SMTPConnectionPool.h>
Public Member Functions | |
| SMTPConnectionPool () | |
| ~SMTPConnectionPool () | |
| int | sendMail (string &from, string &to, string &msg) |
| void | setPoolSize (unsigned long) |
| unsigned long | getPoolSize () |
| void | setSMTPHost (string host) |
| void | setSMTPPort (int port) |
| void | setMyHostname (string myname) |
| void | setOptimizePool (bool) |
| void | setMinPoolSize (long) |
| void | setMaxPoolSize (long) |
The SMTPConnectionPool sets up an amount of SMTPConnections. These connections are threaded objects and run each in a seperate tread. To send a message, just utilize the sendMail-method. The SMTPConnectionPool then tries to find a ready connection and delegates the message to this connection.
Definition at line 24 of file SMTPConnectionPool.h.
| SMTPConnectionPool::SMTPConnectionPool | ( | ) |
Default Constructor.
Definition at line 20 of file SMTPConnectionPool.cc.
| SMTPConnectionPool::~SMTPConnectionPool | ( | ) |
Default Destructor.
Definition at line 30 of file SMTPConnectionPool.cc.
| int SMTPConnectionPool::sendMail | ( | string & | from, | |
| string & | to, | |||
| string & | msg | |||
| ) |
Send an email to the connection-pool.
| string | from sender-email, used in the SMTP-dialog. | |
| string | to receiver-email, used in the SMTP-dialog. | |
| string | msg email-body to send, including additional headers. |
Definition at line 93 of file SMTPConnectionPool.cc.
References ThreadedSMTPConnection::isReady(), ThreadedSMTPConnection::sendMail(), and setPoolSize().
Here is the call graph for this function:

| void SMTPConnectionPool::setPoolSize | ( | unsigned | long | ) |
Sets the pool-size. The pool-size is the number of SMTP-connectons, which are connected to the SMTP-Server.
| unsigned | long poolSize number of SMTP-connections. |
Definition at line 253 of file SMTPConnectionPool.cc.
Referenced by sendMail(), setMaxPoolSize(), and setMinPoolSize().
| unsigned long SMTPConnectionPool::getPoolSize | ( | ) |
Returns the pool-size.
Definition at line 313 of file SMTPConnectionPool.cc.
| void SMTPConnectionPool::setSMTPHost | ( | string | host | ) |
Sets the IP-address of the SMTP-host.
NOTE: Must be an IP-address and no domain-name.
| string | host IP-address of the SMTP-server. |
Definition at line 321 of file SMTPConnectionPool.cc.
References ThreadedSMTPConnection::setSMTPHost().
Here is the call graph for this function:

| void SMTPConnectionPool::setSMTPPort | ( | int | port | ) |
Sets the port-number to connect to. Defaults to 25.
| int | port port-number of the remote SMTP-server. |
Definition at line 335 of file SMTPConnectionPool.cc.
References ThreadedSMTPConnection::setSMTPPort().
Here is the call graph for this function:

| void SMTPConnectionPool::setMyHostname | ( | string | myname | ) |
Sets the hostname, which is send in the HELO-commend.
| string | myname hostname of the mail-sending-host. |
Definition at line 349 of file SMTPConnectionPool.cc.
References ThreadedSMTPConnection::setMyHostname().
Here is the call graph for this function:

| void SMTPConnectionPool::setOptimizePool | ( | bool | ) |
Tells the pool wether or not to optimize the pool-size.
Optimizing tries to find a pool-size, which has enough connections so that a new sendmail-command does not have to wait for previous connection to finish.
The optimal pool-size is calculated and set, if within the upper and lower limits set with "setMinPoolSize" and "setMaxPoolSize".
Please remember, that changing the pool-size also affects allocating or deallocating of new/existing objects. This results in small performanc-impacts. The bast way is to already know the optimal pool-size, initialize the pool with that size and disable optimizing the pool.
NOTE: Optimizing the pool-size is not a trivial task. The algorithm used in this implementation, is a rather simple approach. Works for me, but might not be smart enough for you.
| bool | opt true / false = optimize / do not optimize the pool-size. |
Definition at line 363 of file SMTPConnectionPool.cc.
| void SMTPConnectionPool::setMinPoolSize | ( | long | ) |
Sets the minimum size of the connection-pool. Takes effect only, when pool-optimization is active.
| long | minimum minimal pool-size. |
Definition at line 370 of file SMTPConnectionPool.cc.
References setPoolSize().
Here is the call graph for this function:

| void SMTPConnectionPool::setMaxPoolSize | ( | long | ) |
Sets the maximum size of the connection-pool. Takes effect only, when pool-optimization is active.
| long | maximum maximal pool-size. |
Definition at line 383 of file SMTPConnectionPool.cc.
References setPoolSize().
Here is the call graph for this function:

1.5.1