I need to send a large number of emails (not spam!) through an external SMTP server that requires TLS and a username/password. I have some control over the SMTP server but very little over the web server where the scripts reside. How do I connect with TLS, authenticate and send the mail? I had problems with mail() originally (one of the reasons why we now have a dedicated mail server) and I had to connect to the SMTP server by hand with sockets and go through the SMTP steps by hand. I can connect to the new server with following code. $sock = fsockopen( 'smtp.eg.com', 25, $errNo, $errStr ); However, when I send the "rcpt to:" line, I'm told I don't have access to the relay - i.e. I need to log in. This is where my knowledge of SMTP reaches it's limit but I've read about the "auth login" command, however, it says it needs to be run over an encrypted connection, i.e. TLS. I can't disable this on the server, other services need TLS to be on the SMTP server. I've tried changing "smtp.example.com" to "tls://smtp.example.com" but it then fails to connect at all ($errNo is "115", $errStr is "Operation now in progress"). If I connect and send starttls, I don't get any more data from the server and I've no idea what it's waiting for, be it a public key or whatever. FWIW, the email server's certificate is a dodgy, home made one which throws up a security error when tested with a mail client, but once accepted it is fine. Is there an easier way to do this? If not, how do I get the connection so I can get to and "rcpt to:" line and beyond? Thanks, Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php