SMTP :: mixed connect ( string address [, integer port [, string username [, string password [, string ssl [, integer timeout [, string name [, resource context [, string auth_type ]]]]]]]] )
Return RESOURCE connection if has been successfully connected, boolean FALSE if not. Default values are: integer port: 25 integer timeout: 30 string name: localhost string ssl possible values are: tls, ssl, sslv2 or sslv3 Notice: string address can have hostname or IPv4 value. The standard port values are: 25 - default, and 465 - SSL (secure). string name is used in EHLO/HELO SMTP conversation. Example:

// connect to MTA server (relay) 'smtp.hostname.tld' via SSL (TLS encryption) with authentication using port '465' and timeout '10' secounds
// make sure you have OpenSSL module (extension) enable on your php configuration
$c = SMTP::connect('smtp.hostname.tld', 465, 'username', 'password', 'tls', 10);

// print result
if ($c) echo 'Successfully connected !';
else print_r($_RESULT); // <- for debugging

See Also: SMTP::Disconnect(), SMTP::MXconnect(), SMTP::Send() [ Comments ] Last update: Sunday, June 24, 2007